From the vantage point of a physicist and the kind of problems he would like a computer program to solve, what are the essential programming languages that a physicist should know.

I know C++ and I have worked in ROOT. I have also found Mathematica quiet essential, however since shifting to a linux machine I've been trying Sage which is also good, though not quiet at the same level right now. I have found C++ to be really fast, efficient, and best suited for stuff like Monte Carlo simulations. However, it appears that scimpy is also quiet popular. Would it be worthwhile to invest time in learning python, i.e would it have significant gains?

I also find the concept of functional programming languages much appealing. I think physicists unlike many programmers are more inclined to think this way rather than iteratively. Haskell sounds like a good candidate and I've also heard that it is ideal for simulating quantum algorithms on classical machines. Is anyone familiar with it?

Also what about scripting languages? I do not know any of those, except basic directory navigation in bash. Is there any utility in Perl and whatever is out there (I know little about these)

  • 2
    $\begingroup$ You might be able to glean some helpful information from Practices for programming in a scientific environment? on Stack Overflow. $\endgroup$ – dmckee May 25 '11 at 16:54
  • 12
    $\begingroup$ It seems on topic to me. The OP wants input specifically from physicists. However, I prefer questions not to ask so many different things all at once. (Aside: if you're using SAGE, you're already using Python.) $\endgroup$ – Mark Eichenlaub May 25 '11 at 21:44
  • $\begingroup$ MATLAB is more or less essential as a prototyping platform and C/C++ certainly if you want to perform more customized numerical calculations in your research. $\endgroup$ – BjornW May 25 '11 at 22:48
  • 1
    $\begingroup$ Approximist has opened a topic on meta to discuss the proper state of this question. Please jump in. $\endgroup$ – dmckee May 26 '11 at 0:46
  • 2
    $\begingroup$ @dmckee After giving it some thought, I no longer appeal the closure. I have added my perspective on the meta post. $\endgroup$ – Approximist May 28 '11 at 4:09

In computational physics (and other computational disciplines), not enough attention is paid (much of the time) to reproducibility issues and too much is paid to execution speed. The main advantage of "literate" languages like Python is that it is pretty easy to write readable, easily documentable, and testable code, and to do so quickly. That makes it more likely that the code is "correct", and more likely that others will be able to understand what you have done (basic requirements in experimental work). At the very least, python and other high level languages like it are great for prototyping algorithms before spending the effort to fine tune C++ or fortran code -- and for many tasks where execution speed doesn't matter at all, one might as well do all the work "literately".

Check out the Software Carpentry project (http://software-carpentry.org/) for more on scientific computing, reproducibility, and Python.


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