I'm entirely new to the notion of computational science, and am looking for a good starting point.

I understand that there's no objectively best language, but I'd like to learn a language that has an unarguably strong and prominent presence in regards to computational science — one considered to have exceptional capability and efficiency.

To start, I was leaning towards modelling related to atom bonding and interactions, with a requirement for graphical representations/simulations.

Do some languages tend to be better for some fields than others (i.e. physics vs. pure math)? Or is choosing a language based on other factors?

I've heard the name Fortran being thrown around a lot.


  • 1
    $\begingroup$ C++ and Fortran are well known languages in the community. Recently, you can see a rise in the use of dynamic languages. Often you choose your library and not your language. $\endgroup$
    – vanCompute
    Feb 3, 2013 at 15:08
  • 10
    $\begingroup$ I'm reminded of the dictum that Real Programmers can write Fortran in any language. $\endgroup$
    – hardmath
    Feb 3, 2013 at 18:42
  • 1
    $\begingroup$ Here is a very similar question with lots of answers: scicomp.stackexchange.com/questions/304/c-vs-fortran-for-hpc $\endgroup$ May 8, 2013 at 8:25
  • 1
    $\begingroup$ "I understand that there's no objectively best language" - precisely, so why not learn to be language-agnostic, so that you can write in whatever language thrown at you? $\endgroup$
    – J. M.
    May 8, 2013 at 9:01
  • 3
    $\begingroup$ You have to master English. Without it, you won't get anywhere in Computational Science. $\endgroup$
    – Johannes
    May 9, 2013 at 14:13

6 Answers 6


Mostly it comes down to the numerical libraries available to you that will help to accomplish your task. C/C++ have a large number of numerical libraries implemented for them, but being low level languages are not the best to prototype something quickly.

I think to get going quickly towards a solution, I would recommend using something like Matlab or Mathematica. They have large toolset and are very high-level. Most likely, your implementation there will not scale for production use, but it could be a nice playground for trying out different methods. Once you know a path to take, you can always implement something in C/C++ more efficiently.

  • 4
    $\begingroup$ Many people--both inside and outside academia--don't really trust code unless it has at least some minimal automated testing suite. I don't know what the tooling is like for such things in matlab and mathematica, but there are several nice packages for more mainstream languages like Python and C++. $\endgroup$
    – cjordan1
    Feb 4, 2013 at 17:54
  • 3
    $\begingroup$ MATLAB has MATLAB xUnit, but Python and C++ have more (and, in my opinion, better) testing suites. $\endgroup$ Feb 5, 2013 at 1:15


  1. Start off directly using the numpy library, small scripts, and the ipython interactive shell.
  2. Get more advanced with the help of numerous free books and tutorials.
  3. Get more productive using scipy as a frontend to highly performant numerical routines and matplotlib for visualization
  4. Take advantage of well developed and powerful modules for scientific computing as Krypy, FeNiCS and lots of others
  5. Notice, that the smooth transition between flat and object oriented programming and the inherent modularity of Python make larger projects easy to handle.
  6. Make your code as fast as C or Fortran by simply rewriting critical parts in cython. You can also easily include routines written in Fortran or C.

This paraphrases what I think is the best way to approach a problem in scientific computing. Start with getting a hand on the problem by playing around with toy examples in small scripts. Become more systematic and set up a suite of code. Then make your code work!!! Finally, if necessary, do code optimization. Don't reinvent the wheel and don't do premature optimization.

(Additional plusses: Python comes for free - no license issues, large community e.g. on stackoverflow, modules for good programming as unit testing or logging ... )


Try Python as described for instance in the book Python Scripting for Computational Science.


Python can be a great starting point. Following resource is a great starting point.



Fortran: Matlab like, easy to learn and use and quickly get productive but only good for numerical computing

C++: Difficult to master (will take you years) but used a lot outside of numerical computing (job security)

Python: Recommended a lot these days but too slow for non-trivial work. You'll have write all your underlying computationally expensive kernels in C and then call them from Python which means that you'll have to learn (at least) two languages

  • 1
    $\begingroup$ I would argue that the learning curve for Fortran and C++ are somewhat similar. I picked up sufficient skills in both to solve the simpler end of problems in a matter of a few months each coming from a background of java, matlab, and c#. Depending on what languages someone knows, I could see c++ being much easier to learn than fortran since most large codes out there are written in dated versions. $\endgroup$ May 8, 2013 at 13:51
  • $\begingroup$ @Godric: At ~600 pages the Fortran 2008 standard is less than half of C++11 (~1300 pages) $\endgroup$
    – stali
    May 8, 2013 at 14:57
  • 1
    $\begingroup$ @stali, Yes, but for instance I work with approximately a quarter million lines of legacy code written in Fortran77. So I had to learn the style of 77 to be able to work with it, 90-95 to make maintainable changes to it (since common blocks are attrocious), and then '08 to not be stuck over a decade in the past. Fortran, while an old language, has underwent enormous changes over the past decades, and unless you are starting from scratch, learning its legacy is non-trivial. $\endgroup$ May 8, 2013 at 15:46
  • 2
    $\begingroup$ I would disagree with the statement that Python is "too slow for non-trivial work". Indeed, if you write your matrix-vector multiplications (and the like) purely in Python, you're going to have a bad time. The abstraction to some more efficient languages has already been done for you though: NumPy, Scipy probably have all you'll ever need. Or one of the other 50,000 packages. $\endgroup$ May 10, 2013 at 12:17
  • 1
    $\begingroup$ @NicoSchlömer I'd agree with "too slow for non-trivial work". My simulation in Python (Numpy/Scipy) slower than same code in Fortran90 version about 10x. I recommend Fortran90 or C++. $\endgroup$
    – fronthem
    Feb 22, 2016 at 13:52

Short answer
Learn about the basics of object oriented code through python, and learn about the basics of computer science through C. When you're at least pretty okay with both of those other languages learn C++, because you can do pretty much anything in C++ and make it run quickly (though it takes forever to write).

Longer answer
So, here's the thing: for your first project you'll be in somebody's lab working on somebody else's code. In which case they'll be the one choosing the programming language. Which I personally think is kind of great!

I mean, as a beginner you're not really going to know your ass from you elbow for a while, and, especially when you don't know what you're doing, learning to program can be borrring. Thus, it's good to have the structure and limits that come from working on somebody else's code, and it's good to have the motivation and excitement that can only come from working on a real project.

Still, regardless of whatever language your lab uses (especially if it's Matlab), you should probably learn python, C, and C++. In particular, if you're not coming from a computer science background you MUST read Kernighan and Ritchie's "The C Programming Language". It's 35 years old and gives the distinct impression that its authors were programming on punch cards, but it is that rarest of birds: a timeless computer science book. It will make many things a great deal clearer.


Not the answer you're looking for? Browse other questions tagged or ask your own question.