Mathematica and MATLAB

In some ways there are many similarities between Mathematica® and MATLAB®. From the simplest point of view, both are computer mathematics systems. I use both at work and, thus, am a wizard at neither. Let me expose my biases up front though. I like Mathematica enough that I have paid actual money to have a copy at home. With that bias in mind, let’s look at some of the differences.

Handling of Matrices

Let’s start with this one since it is supposedly the primary strength of MATLAB. However, after using both systems, there really doesn’t seem to be much difference between the two. It’s just as easy to create and manipulate matrices in Mathematica. And both systems make it so much easier than more traditional programming languages. You might get by with typing a few less characters in MATLAB, so lets give this one to MATLAB.

Default Functionality

Both systems sell add-ons for more specialized areas like statistics or financial computations. I used to think MATLAB had the more useful set of default functionality, but that seems to be changing. With version 7, Mathematica included a rather nice amount of image processing functionality. In version 8, wavelets are included too. Those are big things for me, but maybe not for you. I would give the edge to Mathematica here.

Handling of Text

No contest here. Mathematica is superior in every way I can think of.

Symbolic Mathematics

Again, there is no argument. Mathematica whoops ass big time.

Numerical Mathematics

Things seem pretty even here. Both systems do a good job. Not sure about how well each covers the domain of each function or how they handle out of domain arguments, but I have no complaints about either system.

UI Development

Here’s an area where I give the edge to MATLAB. It is easy to put together a simple GUI quickly. The GUI is very much like building an interface with Java’s Swing library. I have a fair amount of experience with Swing, so it feels very natural to me. It also seems like you can modify default behavior more easily than with Mathematica.

Programming Language

Writing scripts in MATLAB feels like piecing together randomly-named functions into a quilt – clearly not a uniform whole, but you get something that works in the end. The Mathematica programming language is extremely tasteful and uniform. The naming of functions is very consistent as is the application of those functions to data that can seem very different. The language seems much more powerful with very Lisp-like features. The language supports a few different programming styles too, such as functional and object-oriented. You’re free to use whichever you like. You aren’t forced to be consistent (although have mercy on those who come after you.)

Other Spurious Observations

Mathematica feels like the more tasteful and stylish system. It seems more powerful and flexible as well. It’s hard to quantify but feels a bit like the difference between an Apple computer and a PC. One feels like an integrated whole with a very minimalist surface that you can dig beneath if you need the additional power. The other feels like a patchwork. If you find inconsistency and ugliness unbearable Mathematica is the way to go. And it is every bit as powerful, if not more so.

Another difference seems to be in the two sets of users. Mathematica seems to have its biggest audience among scientists. MATLAB seems to appeal to engineers. Not sure why that is.

Summary

So, given a choice, I would use Mathematica for everything. But there is not always a choice. Sometimes speed to results is important and there seems to be more code developed for MATLAB, at least in the areas I work. That pre-existing code can give you an edge, so you use MATLAB to keep the edge. You just feel icky doing it.