Mathematica vs. MATLAB philosophy
Well, here's my reply to a similar question from a while back:
I'm looking for comprehensive and rather long answers to these questions.
- What's the difference between Mathematica and MATLAB?
Several letters in the names.
- Can MATLAB do what Mathematica does and vise versa?
Yes. Both are Turing complete. Good luck writing heavy symbolic work in MATLAB though.
- What are the pros and cons of each of them?
Many pros here at this site, a few users have done prison time. No idea re: Matlab expertise or criminality.
- Who are the appropriate users of each tool?
Ones that make up their own mind based on experience with the two vs taking polls.
- Will it benefit someone if he knows both of them?
Sure, they can answer comparison questions.
- What are the capabilities of Mathematica that makes it unique?
Stephen Wolfram. 'nuf said. And if you disagree, he'll send a pack of wild cellular automata your way to... "evolve" your opinion.
- Can Mathematica play the role of an easy to use advanced scientific calculator for an engineer who is most of the time dealing with multi-variable calculus and partial differential (electromagnetism) equations?
Yes.
In all seriousness, I use (daily) Mathematica and MATLAB, and weekly Maple, NumPy, SageMath, and PARI/GP.
They are all capable of doing what the others do, with varying degrees of effort and/or self-flagellation depending on the task at hand.
I think a large part of the tribalism re: Mathematica/MATLAB is simply a case of knowledge passing - the engineering professor was taught and used MATLAB, so torpedoes be damned, that's what they'll mandate. It kind of makes sense - the tool does what they need, and there isn't any need to fix it if it's not broken.
For much of what I do, the symbolic capabilities of Mathematica along with its comprehensive probability capabilities make my tasks much, much easier than trying to do the same in the other tools.
If I were forced to pick one and only one of my tools in the mathematical toolbox, it would be Mathematica, simply because I can do in it anything my other tools can do, and I can easily do in it things the other tools are either intrinsically incapable of doing and/or require me to write my own symbolic CAS.
On my deserted island, Mathematica is my Wilson...
I have just purchased both for personal use and am getting used to both. Before that I had various experience in other paradigms, including Lisp, Prolog, Algol-like languages, a bit of Fortran, C, etc. I like the two M's for their built-in graphics.
MATLAB
For me, I would say that, once you get used to MATLAB's syntax, everything is pretty straightforward.
Mathematica
Because Mathematica is a pattern-substitution language (and therefore unusual), it is very easy to lose track of what is happening behind the scenes. The order of evaluation is critical and can trip you up. I haven't yet discovered a definitive list of operators and their precedence - yet knowing the precedence is vital. There are lots of operators that can be written in different forms (prefix, postfix, and infix) with different symbols and they aren't well-documented unless you already know what to look for.
Because of the way Mathematica works, local variables have to be thought about very carefully and there are special structures for the purpose. By default all variables are global.
If you are someone who wants to know the nuts and bolts of a language, there is a sea-bed below which you can't penetrate in the documentation unless you know the right people.
You can use Mathematica to simulate pretty much any other paradigm without a great deal of work but then, why not use a purpose-built language?
For example, it is possible to program it in a procedural way, but watch out for scope of variables (and whether or not they remain as symbols for much of the process or are evaluated early). Sometimes you just can't stop early evaluation despite functions that supposedly do so.
Conclusion
Despite all this (and more) I like Mathematica (and its absolutely amazing knowledge base) and it is consistent most of the time. However if you just have a programming job to do and MATLAB fits, then I would get MATLAB and get to work.
There is also a matter of speed of execution. I haven't done any measurements because {reasons}, but Mathematica can be pretty slow (and inconsistently so) unless the functions you are using are built-in and have been optimised.
I could go on, but I've only had them a short while so I'm in no way an expert.
The main difference between Mathematica and MATLAB has to do with the primary nature of their respective programming language:
Mathematica is a (mostly rule-based) term rewriting language born for symbolic analysis that has developed a very extensive set of specific procedures, even in its core functionalities.
MATLAB is a procedural language with a very limited (this is an advantage) set of core commands and was born for numerical analysis.
You can have one do what the other does, but you might have to jump through hoops to do it as efficiently as the competitor when it comes to their relative strengths. So, symbolic manipulation can become cumbersome in MATLAB, while numerical resolution of PDEs might be slower and much more memory consuming in Mathematica.
EDIT to elaborate on the difference:
Mathematica's term rewriting is extremely powerful but it's more recursive than procedural and as such tends to use up a lot of memory to be carried out. MATLAB's procedural style is more straightforward and works by updating preinitialized array structures.
In a way it's like Mathematica does all its calculations in its head and spits out the result in the end, while MATLAB does its calculations step by step with pencil and eraser on a piece of paper, updating partial results on the go.
Moreover, the limited core set of MATLAB's commands allows (the procedural) programs to be scrutinized with only a basic knowledge of a handful of statements and also makes them easily translatable in other procedural languages.
Mathematica, on the other hand, tends to hide the implementation details under the hood, in a flurry of specific procedures and methods (selectable by options) that can change from one version to the other. The magic Mathematica performs is not so easily translatable in other languages. This is both an advantage (you can do stuff in five minutes that other languages would require days of coding) and a disadvantage (if you are reading or peer-reviewing a paper with procedures written in Mathematica - even more so if you have an older version or no version at all).
[Unsolicited opinion] I believe both programs have evolved so much that they are now the scientific equivalent of an Hollywoodian reboot whose special effects did not cost anything during production.