There are three aspects to consider when replacing Matlab with Python; the core language capabilities, the IDE and the Price.
Capabilities Comparison
This section outlines all of the capabilities of each platform. In short everything Matlab can do, Python can also do plus much more. However, things like linear algebra and rapid prototyping Matlab does more cleanly.
Matlab
Everything in Matlab is ready bundled and toolboxes are seamlessly integrated. It is also much more mature - but was not designed for general purpose programming meaning anything not linear algebra related is painful to implement.
- Toolboxes: The Matlab toolboxes are very good and python implementations often struggle to compete with them (even for not so specialised things like optimisation algorithms).
- Linear Algebra: Matlab has concise linear algebra capabilities which are easier to read and interpret.
- Visualisation Capabilities: Has very good and very broad range of visualisation capabilities.
Python
Python will require a number of additional modules for it to become a good Matlabreplacement.
- General Purpose Programming: Python is a proper programming language which offers a lot more flexibility over Matlab.
- Numpy: Provides arrays and linear algebra routines, however has more awkward syntax than Matlab. I have fallen in love with the broadcasting feature however, no more
repmat
rubbish.
- SciPy: Stats, optimization and other useful mathematical stuff.
- MatPlotLib: Provides, in my opinion, higher quality plots than Matlab. Furthermore it is designed to be syntactically similar to Matlab so should be easy to pick up.
- SymPy: Good symbolic programming package.
IDE Comparison
This is where python is lacking in my opinion. I simply find algorithm development (particularly involving a lot of linear algebra) less painful in the Matlab IDE.
Matlab
Here are some key Matlab features which will be hard to live without as an engineering student. Note that Python IDEs do have some of these capabilities also, but are more sloppily implemented.
- Powerful Debugging: Can easily explore functions in a very non-restrictive manner. Python also allows for debugging but is often not as cleanly implemented in the IDEs.
- Variable Explorer: MATLAB has a good variable explorer which always good for viewing of many supported data types. Some python IDEs struggle to display numpy arrays which can be annoying.
- Variable Survival: If code breaks during runtime, the variables still persist which helps debugging. Furthermore it is easier to run different scripts in a row assuming persistent variables. In Python you will have to manually save variables in a script to have them available for other scripts.
- Profiler: Very good for a breakdown of where your algorithms are bottlenecking.
- Command Line Single line instructions can be executed on the command line. Python is full support for this also in all good IDEs.
- GUI Plotting Tools: Results and variables can be quickly and painlessly plotted from the user interface. Most Python IDEs are geared towards software development and so don't support this (although sypder does have limited support through matplotlib).
- Documentation: All functions have native documentation within the IDE.
Python
There are some new python IDEs which are starting to compete with some of MATLAB's key advantages. I personally like PyCharm which was recently released as a free community version. It has the following capabilities and is very well designed from a UI perspective.
- Bebugging
- Variable Explorer
- Command Line
- Documentation
Price Comparison
Python is free and has an active support community. Matlab also had a good support community too, but is anything but free.
MATLAB
andPython
I've read, which mentions many of the features that really make a difference is this. – Gagger