Programming languages v Mathematica/Matlab

  • Mathematica
  • Thread starter wanfife
  • Start date
  • #1
1
0

Main Question or Discussion Point

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!
 

Answers and Replies

  • #2
DavidSnider
Gold Member
487
131
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.
 
  • #3
33,714
5,412
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.
 
  • #4
Pythagorean
Gold Member
4,193
258
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).
 
  • #5
phyzguy
Science Advisor
4,572
1,507
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 langauge like C can run 100's to 1000's of times faster than something like Mathematica on calculation intensive code.
 

Related Threads on Programming languages v Mathematica/Matlab

Replies
4
Views
2K
  • Last Post
Replies
20
Views
176K
  • Last Post
Replies
12
Views
1K
Replies
3
Views
2K
Replies
1
Views
3K
  • Last Post
Replies
2
Views
954
  • Last Post
Replies
7
Views
6K
  • Last Post
Replies
4
Views
2K
Replies
10
Views
20K
Top