Python vs Matlab

We regularly hear of people (and whole research groups) that transition from Matlab to Python. The scientific Python ecosystem has been maturing fast in the past few years, and Python is an appealing alternative, because it's free, open source, and becoming ever more powerful. This page tries to explain the differences between these two tools.

Matlab and Python and their ecosystems

Python, by definition, is a programming language. The most common implementation is that in C (also known as CPython) and is what is mostly refered to as "Python". Apart from the programming language and interpreter, Python also consists of an extensive standard library. This library is aimed at programming in general and contains modules for os specific stuff, threading, networking, databases, etc.

Matlab is a commercial numerical computing environment and programming language. The concept of Matlab refers to the whole package, including the IDE. The standard library does not contain as much generic programming functionality, but does include matrix algebra and an extensive library for data processing and plotting. For extra functionality the Mathworks provides toolkits (but these cose you extra).

Diagram illustrating the differences between Python and Matlab in terms of their ecosystem.

To do scientific computing in Python, you need additional packages (e.g. Numpy, Scipy, Matplotlib). Additionally, you'll need an IDE. Many pythoneers come from a Linux environment and use a Python shell and an editor (like vi or Emacs), but people coming from Matlab prefer a feature-rich IDE (us included). There are a handful of IDE's available, some of which are for free.

Because Python is open and free, it is very easy for other parties to design packages or other software tools that extend Python. It is possible to create applications using any of the mayor GUI libraries (e.g. Qt), use OpenGL, drive your USB port, etc. Another example is Cython to enhance the speed of algorithms by converting Python to C code, and PyInstaller to create a standalone application from your source.

Each package is being developed by a different (but often overlapping) group of people, who are also users of the package. Many packages are available for different purposes. In this open source ecosystem most packages are driven by a handful of core developers, but many of a package users contribute to the development by reporting issues, helping with documentation, and making small improvements to the code.

The problem with Matlab

We do not intend to make Matlab look bad. We used to love Matlab ourselves! However, we think that Matlab has a few fundamental shortcomings. Most of these arise from its commercial nature:

Furtheremore, there are some other issues that stem from Matlabs origins as a matrix manipulation package:

Advantages of Matlab

Of course, Matlab has its advantages too:

Advantages of Python