Saturday, February 5, 2011

Python: Tips for Matlab Users: Getting Started with Python

Engineers are not computer scientists and as such Matlab is perfect for us guys that don't want to screw around with nonsensical syntax. Computer science guys are so damn pretentious about their programing languages i'm sure some of them will read this and get a little red in the face. Let's face it though; our job is NOT to write elegant codes. Our job is to solve practical engineering and applied mathematics problems. With Matlab, we don't have to spend an hour trying to find where the damn missing bracket is supposed to go (i hate you most c and c++ lol). It's clean, simple, powerful, and it just works. The trade off is speed...sometimes...

Enter python and more specifically numpy, scipy, ipython, and matplotlib.

But first - why python? Beats me...but it was recommended to me. That's not 100% true though. Mostly it's simplicity of syntax compared to c and built in fortran wrappers for those awesome Lapack, Linpack, Blas...(idk if they are all fortran but whatever...they are all there). In fact with a little set up, the python commands can be reduced to nearly the same as Matlab.

Problem #1: As of early 2011 python is experiencing a large overhaul from v2.x to v3.x but numpy, scipy, and matplotlib aren't ported yet.

Problem #2: The sponsored numpy download installs over python 2.6 - python 2.7 is the currently available release. Idk where 2.6 is hosted.

Problem #3: Scipy needs numpy. Scipy installs over python 2.7. Numpy installs over 2.6. Scipy can't be installed since numpy can't be installed.

I could probably figure out #2 and 3 but back to the original statement - why should I have to. You developers are the computer science guys. If that's the best you can do...then I hope you never get hired to develop something for the general public!

Solution: Enthought. It packages it all together with one install so you don't have to screw around. Everything mentioned here is for fundamental scientific computing and visualization so specialized packages may or may not be available in python. Enthought has 32 and 64 bit versions and if you have a 64 bit operating system definitely use the 64bit version or else you won't have the same speed optimization that Matlab offers. In reality Enthought probably doesn't offer anything unique but it simplifies and consolidates the install process. It's not free (academic licenses are) but it's a hell of a lot cheaper than Matlab!

No comments: