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

Programming languages v Mathematica/Matlab

  1. Aug 30, 2011 #1
    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!
     
  2. jcsd
  3. Aug 30, 2011 #2

    DavidSnider

    User Avatar
    Gold Member

    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.
     
  4. Aug 30, 2011 #3

    Mark44

    Staff: Mentor

    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.
     
  5. Sep 3, 2011 #4

    Pythagorean

    User Avatar
    Gold Member

    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).
     
  6. Sep 3, 2011 #5

    phyzguy

    User Avatar
    Science Advisor

    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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Programming languages v Mathematica/Matlab
  1. Matlab programming (Replies: 0)

  2. Programming in Matlab (Replies: 4)

Loading...