MATLAB Programming languages v Mathematica/Matlab

  • Thread starter Thread starter wanfife
  • Start date Start date
  • Tags Tags
    Programming
AI Thread Summary
For scientific calculations, modeling, and graph production, coding in compiled languages like C, C++, or Fortran offers significant speed advantages over interpreted languages such as Java, Python, Mathematica, or Matlab. Compiled languages can execute calculations hundreds to thousands of times faster, making them ideal for applications involving large data sets and intensive computations. However, these languages may not express mathematical concepts as easily as Mathematica or Matlab, which provide extensive libraries and infrastructure for tasks like parallel processing. Matlab excels in handling matrices and arrays, particularly beneficial for digital signal processing and linear algebra, but users may encounter issues like floating point errors when working with complex operations. Overall, the choice between these programming approaches hinges on the specific needs for speed versus ease of use and mathematical expression.
wanfife
Messages
1
Reaction score
0
Can anyone give me a quick answer to this question:

For scientific calculations, modelling, producing graphs etc, what advantage is there to coding in Java, C, C++ , as opposed to just using much simpler programs like Mathematica or Matlab?

Thanks!
 
Physics news on Phys.org
The advantage would be speed. The disadvantage would be that the language is not really fine tuned to express mathematical concepts easily.

Also Mathematica has a huge amount of libraries that are already proven to be accurate and there is a lot of infrastructure in place to do things like parallel processing.
 
If your application needs to work with large sets of data and do lots of calculations, it will probably run faster if written in a compiled language such as C, C++, or Fortran. If it is written in an interpreted language such as Java, python, Mathematica, or Matlab, it will probably run quite a bit more slowly.
 
note that in the case of matlab/python (at least, not familiar with others) there are compilers available. I thought python actually was a hybrid (i.e. if you run a function and then don't make changes, it will stay compiled; the first run, however, is interpreted and compiled on the fly). Matlab you have to go through a bit of trouble to get things compiled.

Matlab's greatest advantage is the way it handles matrices and arrays, which is very handy to digital signal processing and linear algebra operations (though, when I vectorized my 200+ dimension ODE, I got floating point errors in my hyperbolic cosine function that made my solutions blow up to INF, so the if statements were the only way I could make it work so far; I might as well have used C++ for this).
 
Just a comment, since I had this same question at some point. As already said, the main reason to use a compiled language such as C or C++ is for speed. My comment is that the speed improvement can be very substantial; a compiled language like C can run 100's to 1000's of times faster than something like Mathematica on calculation intensive code.
 

Similar threads

Replies
5
Views
3K
Replies
1
Views
2K
Replies
22
Views
4K
Replies
7
Views
2K
Replies
23
Views
3K
Replies
3
Views
2K
Replies
7
Views
6K
Back
Top