views:

382

answers:

5

I once saw a dismal comparison of Matlab vs Mathematica. As you can see Matlab achieves the same with very little code. It looks highly efficient to an untrained eye, so I ask, what types of projects is Mathematica good for? Are there any scientific research problems that are easier solved with it? or is Matlab better for almost every computational math project?

+4  A: 

Pick the proper problem, and you can make almost any language look either good or bad as is your wish. This is especially so if the person making the comparison has an axe to grind, so they might choose a slightly less than optimal approach in one language.

Note that the way you might approach solving a problem would/might be different in Mathematica compared to MATLAB. So simply attempting to replicate the functionality of a list of commands from MATLAB is likely to look more complex in Mathematica, or in some other language.

(Personally, I like MATLAB. But I tend to work on numerically intensive modeling and data analysis problems. At the same time, I would note that the one time I looked, there were more Project Euler solvers with high ratings who have done their work in Mathematica than in MATLAB.)

woodchips
+3  A: 

There's always two sides. Here's the opposite example, where the Mathematica equivalent is much, much, much less code than Matlab.

http://blog.wolfram.com/2007/07/09/always-the-right-time-for-mathematica/

ragfield
+4  A: 

I would consider Mathematica strictly better than MATLAB's symbolic toolbox for analytical math.

For numeric computational projects, especially if they involve arrays, I personally prefer MATLAB, even though Mathematica has good numerical tools as well. I also find coding in MATLAB more easily accessible for people coming from other languages, whereas Mathematica's syntax takes some time to get used to.

If you're unsure which program to use, I suggest going with whatever program you're already familiar with, unless it's analytical, or unless it involves lots of multidimensional arrays.

Jonas
Mathematica's programming language is far superior to MATLAB's. Whatever you do in MATLAB imperatively, you can do in Mathematica using functional programming in 1/20 the lines (not that it's difficult, MATLAB is very verbose). The only thing lacking is Mathematica is OOP.
Artefacto
@Artefacto: I guess if you consider functional programming superior to imperative programming, then Mathematica is better than MATLAB, and Haskell is better than C++. Since more people are more comfortable with C++, or Java than with Haskell, I would still consider MATLAB more easily accessible. Also, I like OOP.
Jonas
+7  A: 

That particular page presents a very unfair comparison. The author appears to be a proficient Matlab user but the Mathematica code is based on someone else's (poorly written) Mathematica notebook. For example, the author's Matlab code simply loads a file in .mat format. The corresponding bit in the Mathematica section reads from a text file and then reformats using nested Do loops. Yet he could have almost certainly used an Import statement, which supports .mat format since at least version 5.2. Of course, it's hard to tell for sure since he doesn't provide the data that he's working with.

Also, his plot commands in the Matlab section are quite simple since they simply use the default format for each plot. The corresponding plot commands in the Mathematica section are much more complicated since each one includes a whole slew of option settings whose only purpose is to force the plot to look like the Matlab version.

In answer to your question, I would say that Mathematica is an outstanding tool for a wide variety of mathy projects, including the one presented here. What one should use depends on a variety of factors including the specific types of problems one is likely to encounter, prior experience, and the tools that one's colleagues use.

Mark McClure
Fantastic! I would appreciate a fair comparison between Matlab / Mathematica. Even a "hello world" program would be appreciated, mainly in the field of data analysis and input/output algorithms.
Jenko
+1, but on the graphics front... It's much more easy to make adjustments to plots with MATLAB... Mathematica is painful to use because it must be done programatically. To compensate this, Mathematica tries too hard to be smart so that the plot looks good the first time without further configuration but this makes even more difficult to fine tune the plots.
Artefacto

related questions