Begin Numerical Computing in Python NOT Matlab
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.
Installation
| Name | What is it? | Installation | Source | Importance |
| Python | The base language | python-2.5.1.msi | http://www.python.org/download/ | Must have |
| numpy | Numerical routines | numpy-1.0.2.win32-py2.5.exe | http://www.scipy.org/Download | Essential |
| scipy | Scientific routines | scipy-0.5.2.win32-py2.5.exe | http://www.scipy.org/Download | Useful |
| matplotlib | 2D Plotting | matplotlib-0.90.0.win32-py2.5.exe | http://sourceforge.net/projects/matplotlib | Useful |
| pyreadline | library needed for ipython shell | pyreadline-1.4.2.win32.exe | http://ipython.scipy.org/dist/ | Optional |
| ipython | Extended python shell | ipython-0.8.0.win32.exe | http://ipython.scipy.org/dist/ | Optional |
| MinGW | GCC (C-compiler) and utilities | MinGW Installer | http://www.mingw.org/ | Optional |
| Distutils Config File | Configuration File for Disutils For Compiling Extensions | distutils.cfg | Optional | |
| pyrex_compile.py | A small script to help compiling pyrex files | pyrex_compile.py | Optional |
- 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
One-stage Installation
The Enthought Tool Suite (ETS) is a collection of components developed by Enthought and our partners, which we use every day to construct custom scientific applications. It includes a wide variety of components, including:
- an extensible application framework
- application building blocks
- 2-D and 3-D graphics libraries
- scientific and math libraries
- developer tools
The cornerstone on which these tools rest is the Traits package, which provides explicit type declarations in Python; its features include initialization, validation, delegation, notification, and visualization of typed attributes.
This is very good for "one-stage" installation of Python and a big bundle of goodies (for example, for a lab, workgroup, or classroom)? — Download Enthought Python Distribution (EPD), for a monolithic installation that includes Python, NumPy, SciPy, Matplotlib, IPython, and many other open source python packages including the Enthought Tool Suite (ETS).
Installing ETS with Easy Install
Easy Install is a Python module bundled with the setuptools project that lets you automatically download, build, install, and manage Python packages.
Further Reading & Reference:
- Brian Blais Talk Slides: python_matlab.pdf
- Instant Python, This is a minimal crash-course in the programming language Python. To learn more, take a look at the documentation at the Python web site, www.python.org; especially the tutorial.
- Python instead of Matlab for plotting?

