Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica widely underrated in Physics? Matlab widely overrated?

  1. Jun 27, 2010 #1

    I have always been in love with computers and started programing early. When I started my studies in Physics like three years ago, people often recommended Matlab. I spent a lot of my spare time playing with it (e.g. solving ODEs, plotting solution, animating, plotting and evaluating experimental data, ... pretty much anything except for simulink). I also used Mathematica from the start (nobody really recommended it, but I already loved CAS at school and figured Mathematica was the most powerful).

    Right now, I am completing my Bachelor thesis, and I programmed like 95% in Mathematica. Now I believe that for most tasks (except perhaps for very matrix-related tasks), Mathematica is more intuitive and easier and more powerful for most tasks, e.g.:

    • ODEs: I can't really say which system is more powerful, but Mathematica worked better for me. I had to compute huge amounts of ODEs with slightly varying initial conditions and a Table[NDSolve[...]] construct is much, much faster than a Matlab ode45 (or so) embedded in a for loop.
    • Plotting: I think Mathematica is inarguably more powerful. There are many e.g. parametric plot commands (in 2D, 3D) which work both for continuous and discrete datasets and which Matlab does not have.
    • Interpolation: Mathematica is incredibly versatile with interpolation. E.g., NDSolve[] returns an interpolating function instead of discrete data. First this confused me, but now I have learned to use it to my advantage. In my thesis, I made intersections between interpolated data and continuous curves (using FindRoot). These kind of tasks would have been very difficult to solve if one had no interpolation but only discrete data.
    • Programming: Matlab is way better for doing tasks which need to be solved with classical, imperative programming. If one cannot wrap one's task into standard (and very fast) Mathematica constructs, one has a problem. However, Matlab is very slow unless one uses its constructs.
    • Experimental Data: Both have curve fitting, allow easy plotting of the solutions, and there is standard deviation stuff etc. in either of them. Matter of taste.

    What I'm saying is: Mathematica is an incredibly powerful tool for analytical manipulation (for which it was originally designed). But "secondary" features like plotting and numerical computation are so powerful now that I see only few areas in which Matlab (having no analytical manipulation functionality of its own) can compete.

    What do you think of this? Do you also feel Matlab is widely overrated for Physics, whereas Mathematica should get more attention? Why do you think so many people use Matlab and ignore Mathematica?
  2. jcsd
  3. Jun 27, 2010 #2


    User Avatar
    Science Advisor

    I have little experience with Matlab, but I use Mathematica all the time. Personally I agree with you that Mathematica is underrated as a tool for doing physics. In addition to the things you mentioned, the tools for symbolic mathematics are outstanding. It's amazing the number of people I meet that think it's "cheating" to use Mathematica to calculate a symbolic integral, but think it's OK to look it up in a table.

    Even when I'm doing programming, I often get the algorithms working first in Mathematica, then translate them to a high level language like C.
  4. Jun 27, 2010 #3
    This means little apart from that you find Mathematica to be more suited to the task you face. This isn't surprising given that Mathematica and Matlab are explicitly intended to excel in different types of problem domains.

    Which is why you avoid for loops whenever possible in Matlab, just as you'd do in any other language. If you constantly find yourself relying on for loops in Matlab you're almost certainly doing something wrong.

    Again, this is where the differing domains of the problems make Mathematica appear to be more powerful. In reality, Matlab is vastly more powerful than Mathematica in terms of visualisation. This is clearly the case if you're trying to visualise data, but similar things can be done in the visualisation of functions through the use of function handles.

    Imperative programming in Mathematica is an abomination that should have been shot at birth, largely due to Mathematica's ridiculous over-reliance on bracketing expressions. Matlab, on the other hand, is much better at imperative programming, and its OOP capabilities are where it really shines in large tasks. If you're not using this you're missing out on a large part of the picture.

    Which is precisely why you use its built-in methods rather than rolling your own slow, buggy versions. If you sit down and plan what it is you want to do, and take the time to see where your code can be vectorised, Matlab will very often be as fast as C.

    They don't. Both are used extensively, often side by side.
  5. Jun 27, 2010 #4
    No doubt that Mathematica is powerful. Still a comparison with Matlab should include the capabilities of Simulink. Simulink is incredibly powerful for modeling real world systems. One can seemlessly combine physical system models, which require continuous time math, with digital control which obviously require discrete time math. The speed with which a system model can be developed in Simulink is truly amazing by any standard.

    Still, all tools have their strengths and weaknesses, and we all can get biased towards to tool we know best.
  6. Jun 27, 2010 #5
    I agree with you. Mathematica seems popular around the faculty members, but the students seem to prefer Matlab.
  7. Jun 27, 2010 #6

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    From what I have seen the learning curve for Mathematica is about as steep as the tangent of 88 degrees for some people.

    I spent a week trying to learn it a bunch of years ago, after a week, I gave up turned to Matlab and was up and running coding my problem in about 2 days.

    Given that, I have not tied to use Mathematica in about 15 years, so I may have an easier time getting going now that I do not have any deadlines looming.
  8. Jun 27, 2010 #7
    One thing I really like about Mathematica is the documentation. It is very well documented, and it is easily accessible online.
  9. Jun 27, 2010 #8

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    So is Matlab, matter a fact I only recently purchased a book about Matlab to help figure out some things that were not completely explained in the online documentation.
  10. Jun 28, 2010 #9
    They're different tools for different things. There's some overlap, but comparing the two is like comparing a bread knife with a steak knife. MATLAB's power is in its matrix handling ability (hence MATrix-LABoratory), even though it is commonly used for 'dirtier' computational programming, which it happens to be able to do (in my opinion) better or at least more intuitively than Mathematica.

    MATLAB has several tools which can allow for the sort of symbolic mathematics that Mathematica can be used for, but generally Mathematica just seems to handle all of that much better with a magnificently designed interface for that.

    Personally, as an engineering undergrad I'm not going to complain about the weaknesses of each software since I've access to both due to my student status. To me, MATLAB is an invaluable tool for data analysis, interfacing with other tools to get data, process it, and prepare TONS of plots in vector eps graphics outputs, automatically save them and do whatever processing and naming interpretation I need to do. I don't know how to do this with Mathematica, but I am under the impression that it is less straightforward. Instead, I do most of my theoretical work in Mathematica. From the student's point of view; when preparing a lab paper, a bunch of my theory will have been verified and modeled in Mathematica, while all of my data will be interpreted and processed by MATLAB.
  11. Jun 28, 2010 #10


    User Avatar
    Gold Member

    Once you get over the hump of learning Mathematica you become severely dependent on it :) I use it for everything up to and including some quantum field theory calcs (FeynCalc is amazing!).

    I feel like Mathematica was designed for people who already have some programming background. Its basically an inline function executor based in the C language. At least thats what it feels like.
  12. Jul 2, 2010 #11
    Whilst i haven't used MatLab i can say that after having used Mathematica from about 2nd year (physics) i find it an amazing tool for pretty much everything, including data analysis (which is what many say MatLab is better for). I even went against my honours supervisor and used it instead of C++ for my numerical simulations simply because what time i lost in computational overhead i gained in the fact that i simply had to use the NDSolve command rather than write a complex adaptive step size runge kutta c++ program :)
  13. Jul 6, 2010 #12
    In my opinion,

    MATLAB is an engineer,
    Mathematica is a physicist,
    Maple is a mathematician.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook