Numerical Computing in Python:
A Guide for Matlab Users
a Faculty Development Seminar
by Brian Blais, Science and Technology Department
Tuesday, May 15, 1PM 2007
MRC Dining Hall
Abstract
Matlab is a commercial program used extensively in the scientific and business
communities. There are many reasons why it is very popular, including its
interactive structure, clean syntax, and ability to interface with fast
compiled languages, like C. It also has many routines for signal and image
processing, optimization, and visualization.
Python is a modern language used extensively by Google and NASA, as well as
many others. Like Matlab, it also has an interactive structure, clean syntax,
and the ability to interface with fast compiled languages, like C. There are
modules in Python for doing numerical work and visualization, and thus one can
make a Python-based computational environment with much the same feel as
Matlab. Python is also free, is far more versatile, and can be used in many
more applications than Matlab, including robotics, web frameworks, text
processing, and others. It is particularly good as a first language, and I
have found it personally very useful in my classes.
This Faculty Development Seminar uses a ``how-to'' approach to setting up
Python as a computational environment, geared towards current users of Matlab
or similar environments. It explores specific applications of numerical
computing, and highlights the power of using Python both in research and in
teaching. The seminar will explore my own experiences of the past year,
converting from a die-hard Matlab fan to a Python enthusiast.
Talk Slides
You can download my presentation here: python_matlab.pdf
Installation
I am including here, for your convenience, direct links to install
Python, and the numerical packages that go along with it. You can
download and install these on your laptop, and bring the laptop to the
seminar, to get the most out of the seminar. If you have any
problems, you can email me at bblais@bryant.edu, and we can also
debug some of this during the seminar. I also provide the links
to the actual websites where I downloaded these install programs.
Optional Install for Writing Extensions
- Run the MinGW Installer, and when asked, extract to folder c:\mingw
- Copy the distutils.cfg to c:\Python25\Lib\distutils folder
- Right-click My Computer/Properties/Advanced/Environment Variables
- add c:\python25;c:\mingw\bin to the path, so it looks something like:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\mingw\bin;c:\python25
Post-Installation Conveniences
- Copy link from Start Menu/Programs/Ipython/IPython to a work directory
- Copy link from Start Menu/Programs/Ipython/pysh to a work directory
- Copy link from Start Menu/Programs/Python25/IDLE to a work directory
- Change properties of IPython link in work directory
- Start In: work directory
- tack on -pylab at the end of target, so it reads something like:
C:\Python25\python.exe C:\Python25\scripts\ipython -pylab
- Change properties of pysh, and IDLE to start in the work directory
Alternate Installation
In the few weeks of making this seminar, I came across a possibly
better Python install for Windows specifically. You can get an
installer at
http://code.enthought.com/download.shtml
After the initial install, you need to click on the button that says
"Do not Accept" to make it accept, and click Apply. Then Click on
the Repositories tab and select individual packages (there is no
"Select All"). The packages you will need are (in no particular
order):
- numpy
- scipy
- matplotlib
- pyrex
- mingw
- ctypes
- ipython
- pyreadline
- pywin32
- wx
You can't really break anything by selecting too much.
The original installation directions will
still work. Don't do both! Choose either the enthought
edition, or the one I've originally outlined.