Over two years ago I wrote The best Matlab alternative with a follow-up a bit later, which seem to have engendered a far amount of discussion.

Well, things have moved on in the computational world, and a user is now spoiled for choice.

Octave has just had version 3.8 released; this version comes with a GUI (which is not enabled by default). However, the GUI is a very fine thing indeed:

As you see, it has all the bells and whistles you may want: command window and history, variable browser, file browser, editor, and a documentation reader. The GUI will become standard as of version 4.0.

I think that Octave has come along in leaps and bounds over the past few years, and as a drop-in Matlab replacement (if that’s what you want) I don’t think it can be bettered.

Scilab is at version 5.4.1, and is a mature product. I have come across a few comments in newgroups to the effect that Scilab is better than Octave for some advanced numerical work. However, I’m not sure if these are just opinions or are backed up with solid data and timings. I used to like Scilab a great deal, but now I don’t see that it offers anything over Octave other than Xcos (a dynamic systems modeller, similar to Simulink), and a few niche extras, such as solutions of boundary value problems.

Python was a language I hadn’t considered in my first post, but with the addition of NumPy and SciPy (plus numerous add-on packages) becomes a definite contender for serious number-crunching. The web is full of stories about people who have dumped Matlab for Python. And of course with Python you get a lovely programming language, and extensions such as Cython, which gives you C-type speed. To get an idea of the packages, see here. Python has a interactive shell IPython which adds enormously to Python’s ease of use.

Julia is the “new kid on the block”: a language which has been designed from the ground up for efficiency and speed, as well as convenience and ease of use. It is supposed to have the power of Matlab, the speed of C, and the elegance of Python. It is still in the early stages (the most recent version is 0.3.0), but it shows enormous promise, and has garnered an impressive list of users and developers. And there is already a small – but growing – list of add-on packages. The Julia web pages show some timings which seem to indicate that Julia is faster (sometimes by several orders of magnitude) than its contenders. (Well, they would, wouldn’t they? They would hardly show timings which were slower than other environments.)

My particular interest is image processing, in which Octave does very well (its image package is quite mature now), followed by Python (with its Mahotas and scikit-image packages). Scilab has its SIP toolbox, but I spent several days trying to install it and gave up. There is an Images package for Julia, but it doesn’t seem on a first glance to have the breadth of the others.

I ran a single test myself: to create a 1000 x 1000 random matrix, invert it, and find the trace of the product of the original and its inverse. In Octave:

`tic; A = rand(1000,1000);Ai = inv(A);trace(A*Ai);toc`

Scilab:

`tic; A = rand(1000,1000);Ai = inv(A);trace(A*Ai);toc`

Python (importing numpy as np):

`%timeit A = np.matrix(np.random.rand(1000,1000));Ai = A.I;np.trace(A*Ai)`

Julia:

`tic();A=rand(1000,1000);Ai = inv(A);trace(A*Ai);toc()`

Note that Octave, Scilab and Julia all have similar syntax; Python is slightly different because functions don’t all exist in the top namespace. This means, for example, you can use a function called “rand” from different packages, with different functionality, easily.

And here are the results (running the code three times each):

Octave: 1.08677; 1.04735; 1.10616 seconds

Scilab: 3.502; 3.425; 3.663 seconds

Python: 2.33; 2.28; 2.39 seconds

Julia: 0.47034; 0.35776; 0.36403 seconds

This is hardly definitive, but it does show how fast Julia can be, and in relation how slow Scilab can be.

These four environments are by no means the end. R is extensively used, and has over 5000 add-on packages at the CRAN repository. However, I’ve never used R myself. I believe it has branched out from its statistical foundations, and is now more of a general use environment, but still with the best statistical functionality in the business. Then there’s the Perl Data Language, apparently used by astrophysicists, and the GNU Data Language, about which I know nothing. See the Wikipedia page for a list of others.

(Note that I’ve not discussed Freemat this time; I don’t believe it’s a serious contender. I had a look through some of its source code, and most of its files seem to be cut-down Matlab/Octave files without any error checking. Anyway, there seems to be no need to use niche software when Octave is so mature and so well-supported by its developers and users.)

My recommendations? Use Octave, unless you have some niche requirements, in which case you may find Scilab more suitable. If you’re prepared to sacrifice maturity for speed, give Julia a go. If your wish is a mature programming language as your base, then Python.

Pingback: The best Matlab alternative (2) | Alasdair's musings

Pingback: The best Matlab alternative | Alasdair's musings

Nice review!

Octave UPM is another option which has also a MATLAB-like GUI.

In fact, Octave UPM is a costumization of GNU Octave designed to work “like MATLAB”.

The idea behind was to develop a real alternative for students at the Universidad Politécnica de Madrid (Spain) who were taught how to program with MATLAB. It has been developed by a professor (@Herraiz) and tested by several students.

In the end, Octave UPM looks more for compatibility with MATLAB rather than substitution (by Octave).

Official website (in Spanish although the software is in English)

http://mat.caminos.upm.es/octave/

One more thing!

We would choose Python if there is no MATLAB heritage code since it is a real programming language (it does almost everything!) with a much bigger community behind.

Scilab it’s also great but has compatibility problems with MATLAB while shares the same limitations.

More about this:

http://www.talyarkoni.org/blog/2013/11/18/the-homogenization-of-scientific-computing-or-why-python-is-steadily-eating-other-languages-lunch/

Interesting! I think your benchmark is comparing the different blas/lapack linked in each language, so it’s basically a race between julia’s OpenBLAS and whatever your numpy/octave/… are using (probably plain atlas given the time differences).

Pingback: Meeting Julia | Alasdair's musings

Thank you for your informative reviews of these software. I am a student at the University of Massachusetts Lowell, and we use Matlab here. While Matlab is available for free use in the computer labs, but we are left to ourselves to obtain personal copies. Your opinion that Octave is the best alternative to Matlab concerning compatibility is very useful to me because it allows me to become more familiar with Matlab’s language and to complete assignment even while the labs are closed.

Web servers crash, and they can get hacked, with devastating results for websites. The same is true of emails, online forms and even offline letters.

Great article. I must make an observation about freemat.

I’m pretty certain freemat does not have a command for finding the null space of a matrix. That’s a dealbreaker for me: it’s an extremely basic matrix operation. I searched their entire user’s manual for the string “null” and found none. I found where someone had asked on an Internet what the command was for this and s/he didn’t get a good answer.

If I’m wrong and freemat does have a command for null space, then I’d be happy to be corrected, and I’d start using it again. I still have it installed on my computer. It has a built-in, easy-to-install, non-experimental GUI (which Octave does not as of Mar. 30, 2014), and from what I’ve seen, its syntax seems closer to Matlab’s than scilab’s syntax is (which is good for me because I want to use it to help teach students who use Matlab).

“Scilab has its SIP toolbox, but I spent several days trying to install it and gave up.” lol true story. I tried install Octave in Ubuntu 12.04 but there’s only version 3.2.4 from the Software cneter. I tried install it from the source but it needs fortran77 to compile (which Ubuntu 12.04 removed? weird. Fortran 95 doesn’t work)

On ubuntu I belive you need gfortran (which will handle the F77 requests). Uninstall or hide any other fortran compiler whil building Octave.

Pingback: Il blog e lamentazioni sullo stesso | Ok, panico