Should i switch to Python?
I recently have been considering switching to the Python programming language. Currently, Matlab is the language of choice in my department for rapid development and prototyping of code. It’s very good at this, but Mathworks (the company who produces Matlab) have been tinkering with the licencing terms, leading to hassles where none should exist.
I have found python+numpy+scipy+matplotlib+IPython+[random sci/numerical packages] to be almost a complete replacement for matlab. There are certainly some packages missing, so if there is a specialized set of tools that are available in matlab but not in python, this might be an issue, but otherwise, I haven't looked back.
I'll mention a couple of distinct advantages of python over matlab
- True programming language instead of a hack of a language thrown over a numerical package (numpy came to python instead of the other way around). Managing large python projects is a complete joy vs matlab. How many different oop systems have been mangled into matlab?
- Totally free and portable. I can use python on just about any machine without licensing issues. This is the biggest advantage from my perspective.
- Wrapping other libraries in C,C++, Fortran is fairly straightforward using SWIG, Cython,f2py,etc vs the ugliness that is a mex file
- Cython for accelerating slow code (although I find that numpy is nearly as fast if not faster than matlab)
- mpi4py vs some other package that I have to buy from matlab to run parallel applications
Personally I use the Enthought Python Distribution for a lot of my work, because it packages everything and is free for individuals in academia. I've alternatively built python and all of its libraries and modules from scratch. Module management is perhaps the largest weakness in python, but there are some nice things to help out like virtualenv and pip
The choice comes down to cost. If you are happy paying for Matlab - especially if you use the toolboxes - you will likely find Python doesn't provide such an integrated package. Having a matrix as the basic data type makes Matlab an intuitive language for many mathematical tasks. Personally, I find the this coupled with the debugger invaluable.
Python, through NumPy, SciPy and the like do provide the same functionality. There will of course be a learning curve to overcome.
If you are performing general programming tasks, that are not particularly applied math solutions then Python is an extremely easy to use and adaptable language. It is also free - which may be a deciding factor.
If you're looking for a wholesale Matlab replacement, you may want to take a look at Python(x, y). It aims to provide a more cohesive experience, rather than leaving new users to trawl the internet themselves looking for the right components to use.
Another option is GNU Octave, which is essentially an open-source clone of MATLAB.
Python certainly is useable as a replacement for Matlab for many cases, by using NumPy, SciPy, and Matplotlib (see my development environment setup guide for how to install all these packages). However, there are some things that Matlab does better, such as providing libraries for interfacing with data collection hardware. So you will need to try Python and see if it meets your requirements.
Should you switch or not depends on what you think of Python. I myself love Python, and I know it is extremely effective for rapid prototyping. The syntax is clean and crisp, and very easy to learn.
To make your decision I recommend visiting the home page, Python.org, and having a look at the docs.
Just download scipy and give it a try.