Mathematica widely underrated in Physics? Matlab widely overrated?

In summary: Matlab can do parametric plots, but they're generally much less versatile and convenient.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) Mathematic
  • #1
keenPenguin
21
3
Hi,

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?
 
Physics news on Phys.org
  • #2
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.
 
  • #3
keenPenguin said:
Hi,

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.:

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.

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.

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.

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.

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.

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.

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.

However, Matlab is very slow unless one uses its constructs.

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.

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?

They don't. Both are used extensively, often side by side.
 
  • #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.
 
  • #5
phyzguy said:
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.

I agree with you. Mathematica seems popular around the faculty members, but the students seem to prefer Matlab.
 
  • #6
Niles said:
I agree with you. Mathematica seems popular around the faculty members, but the students seem to prefer Matlab.

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.
 
  • #7
One thing I really like about Mathematica is the documentation. It is very well documented, and it is easily accessible online.
 
  • #8
Niles said:
One thing I really like about Mathematica is the documentation. It is very well documented, and it is easily accessible online.

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.
 
  • #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.
 
  • #10
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 that's what it feels like.
 
  • #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 :)
 
  • #12
In my opinion,

MATLAB is an engineer,
Mathematica is a physicist,
Maple is a mathematician.
 

1. Why is Mathematica not as widely used in physics as other programming languages?

Many physicists are more familiar with programming languages like Python or Fortran, which are more commonly taught in undergraduate and graduate programs. Additionally, Mathematica can be expensive for individual users, making it less accessible for those outside of academic or research settings.

2. Is Mathematica actually useful for physics research?

Absolutely! While it may not be as popular as other programming languages, Mathematica has a wide range of powerful tools and functions that make it well-suited for performing complex calculations and simulations in physics. Many researchers and academics use Mathematica to analyze data and develop models in various areas of physics.

3. What are some specific advantages of using Mathematica in physics?

One major advantage is Mathematica's symbolic computation capabilities, which allow for more efficient and accurate calculations compared to numerical methods. It also has a user-friendly interface and extensive documentation, making it easier for non-programmers to use for data analysis and visualization.

4. Why is Matlab considered overrated in the field of physics?

While Matlab is a powerful tool for data analysis and visualization, it is often used as a general-purpose programming language in physics, rather than specifically tailored for the field. This can lead to inefficient and cumbersome code for certain calculations and simulations. Additionally, Matlab can be expensive for individual users and may not be as widely accessible as other programming languages.

5. Can Matlab and Mathematica be used together in physics research?

Yes, they can! In fact, many physicists use both languages, with Matlab for numerical analysis and Mathematica for symbolic computations. Additionally, both languages have the ability to communicate with each other, allowing for seamless integration and collaboration between researchers using different tools.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
22
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
Back
Top