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

What programming language(s) should an aspiring physicist learn?

  1. Feb 1, 2009 #1
    I was surfing around the forum, and I noticed that several people recommended learning programming for physicists. What language is most useful for physicist? C? Fortran? Java?
  2. jcsd
  3. Feb 1, 2009 #2


    User Avatar

    The most common language for the subfield you are interested in.
  4. Feb 1, 2009 #3


    User Avatar
    Science Advisor
    Homework Helper

    If you are going to be working in a lot of fields using simulations or models the existing stuff is going to be written in Fortran or very Fortran-like 'C'.
    If you are starting from scratch, python (with numpy and scipy) is good, or if you are in a more theoretical area something like maple or mathematica.
  5. Feb 1, 2009 #4
    C plus plus
  6. Feb 1, 2009 #5
    Matlab/Simulink seem to be pretty big in physics and engineering. LabView is also extremely useful if you do experimental work.
  7. Feb 14, 2009 #6
    I would suggest C/C++. I found that learning this helped me when I was using Visual Basic for Applications, Matlab, PV-Wave etc.
  8. Feb 14, 2009 #7


    User Avatar

    C/C++, Fortran and Matlab are the main ones.

    Java if you're considering working outside academia.

    Labview if you're suicidal and wish to learn the worst piece of software ever created by man.
  9. Feb 14, 2009 #8


    User Avatar
    Science Advisor
    Gold Member

    Well, I don't like Labview either; but it is still the de-facto standard for controlling small(ish) measurements setups and there is not like there is much choice if you e.g. want to control DAQs (I have used Labview on a daily basis for almost ten years). Not to mention the fact that it is the only software EVERYONE knows how to use (I would often prefer to e.g. use the Instrument Control Toolbox for Matlab; but most of my colleagues don't know how to use it)
    Also, Labview isn't a "normal" programming language and is pretty much useless for anything outside the lab so it is not something one would learn INSTEAD of e.g. Python. That said, if you know how to write simple programs in Python, C, Java etc you will be able to write Labview programs almost immediately.

    Hence, learning Labview is a good idea; but wait until you actually need it and learn another language first.
  10. Feb 15, 2009 #9


    User Avatar

    I'm trying to convert everyone to using Matlab's instrument control toolbox instead of labview

    6 lines of code are much neater than 9 boxes and 21 arrows.
  11. Feb 17, 2009 #10
    I've been hopping between IDL and PERL for use in astronomy research. I guess I use a bit of C/C++ as well, but PERL is definitely what I use the most for right now.
  12. Feb 17, 2009 #11
    Python is a very powerful and easy to learn language.
  13. Feb 17, 2009 #12
    Python would be a great place to start.
  14. Feb 17, 2009 #13
    I'd recommend C++. You'll learn a very popular, powerful, and modern language and at the same time learn C into the bargain.
  15. Mar 16, 2009 #14
    Fortran 77 and 93 are still very popular with many researchers.

    Python is becoming the standard though for much of physics and it's much more powerful than MatLab users realise.
  16. Mar 17, 2009 #15

    Vanadium 50

    User Avatar
    Staff Emeritus
    Science Advisor
    Education Advisor

    I think this is the wrong question. You should learn to program, not learn a language.

    There are a lot of people that can cobble something together that runs. There are many fewer who can actually program.
  17. Mar 17, 2009 #16
    I recommend learning Mathematica, since it combines a general programming language with the most powerful symbolic system for doing algebra, calculus, visualizations, etc. It really saves a lot of time!
  18. Mar 17, 2009 #17
    I think Fortran is very easy to learn, it seemed the most "naturally English" to me. I also think Mathematica is a good program, it -really- helped me study for my math methods in physics courses.
    Last edited: Mar 17, 2009
  19. Mar 17, 2009 #18
    Thanks everyone.
    I just have another quick question. My school only offers C++ and java as intro computer science classes. In general, do people learn python, fortran, mathematica, etc. on their own, such as by reading books on the subject or by working in a lab?
  20. Mar 17, 2009 #19
    Introductory C++ and Java classes are a waste of time. They stretch a week's worth of material into a quarter/semester.

    You will probably pick up most languages as you study and work on projects.
  21. Mar 17, 2009 #20


    User Avatar

    Haskell since it forces you to think mathematically.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook