Programing language for quantum mechanics, optics or plasma.

AI Thread Summary
For students specializing in optics, quantum mechanics, or plasma with a focus on computational physics, the choice of programming language is crucial. Python is increasingly favored for its versatility and ease of use, while MATLAB, Mathematica, and Maple are recommended for symbolic and visualization tasks. C and Fortran are suggested for performance-intensive applications, with proponents for both languages highlighting their strengths in numerical analysis. It's important to learn multiple languages and focus on problem-solving methods rather than just coding skills. A well-rounded approach, combining knowledge of different tools and languages, is essential for success in computational physics.
Immersion
Messages
5
Reaction score
0
Hi, I'm student of physics, i want to specialize in the areas of optics, quantum mechanics or plasma, but i want give an approach computational physics, therefore, my question is, which programing language is advisable for these areas of physics?. The options that most i read were fortran, C, C++, phyton; also, specialized software in numeric calculus such as matlab, mathematica, maple, etc.

Thank you for your answers, i want choose the better option.

P.S: I have basic knowledge about C.
 
Physics news on Phys.org
I would say that it really depends on the specific application. For a quick analysis or simulation where you want to be able to play around and quickly change parameters of a system, esp. one that requires generating some sort of visualization (plots etc.), it's definitely handy to know MATLAB, or Mathematica, or Maple, with different people advocating each one, according to personal preference. If I recall correctly, Maple (and I think Mathematica?) can do symbolic algebra, whereas MATLAB cannot? (But there may be some sort of MATLAB add-on module for that). On the other hand, I think that python is starting to supplant these three as a quick and versatile higher-level language that is equally powerful in terms of available visualization tools, and has the advantage of being cross-platform, open-source, and free of charge.

On the other hand, if you're creating a complicated data analysis pipeline, there are some other considerations that enter in, including: 1. you want it to run fast, and 2. you want to be very very sure that you know what's going on numerically, and can avoid common numerical errors. For these reasons, I know of a few examples where data analysis pipelines are written in C or a similar language. There are all sorts of library packages for scientific data analysis in C (and FORTRAN too) each specific to a certain type of mathematical analysis (e.g. linear algebra, or fast Fourier transforms, or numerical integration, or ...)

Unfortunately, you can't get away with knowing only one language and using it exclusively, I don't think. One the other hand, if you invest the time to learn how to *program well* in one language, the marginal cost of learning the syntax for another is less. Personally, I use C regularly, and I've started to use python for some stuff. In the past, I've used MATLAB and IDL. (I've also used Mathematica and Maple, but only because each was required for a particular undergraduate assignment). I know nothing about FORTRAN and don't wish to touch it with a 10-ft pole. But I know that some people will strongly disagree with me and extoll its merits above C.
 
Last edited:
  • Like
Likes 1 person
Immersion said:
Hi, I'm student of physics, i want to specialize in the areas of optics, quantum mechanics or plasma, but i want give an approach computational physics, therefore, my question is, which programing language is advisable for these areas of physics?. The options that most i read were fortran, C, C++, phyton; also, specialized software in numeric calculus such as matlab, mathematica, maple, etc.

Thank you for your answers, i want choose the better option.

P.S: I have basic knowledge about C.

My advice is that you need to know:

(1) One symbolic/visualization tool - Mathematica, MATLAB, or Maple. Personally I use Mathematica.

(2) One quick to write, interpreted language. I strongly recommend Python.

(3) One compiled "number crunching" language. This should be either C or Fortran, and as cepheid said, you will find proponents of both. If you already know C, I would recommend you stick with that. I thought that Fortan was dying in favor of C, but I no longer think that. Lots of people are still using Fortran, and many swear that it is much easier to learn and debug than C.

My experience is that most technical computing today is written with a Python wrapper which does the file handling and plotting stuff, and calls compiled components written in either C or Fortran for the computationally intensive pieces.
 
  • Like
Likes 1 person
You use whatever language the people around you use, and then you learn enough CS so that you can switch whatever language it is.
 
  • Like
Likes 1 person
twofish-quant said:
You use whatever language the people around you use, and then you learn enough CS so that you can switch whatever language it is.

Excellent advice. One of the worst things a physics grad student can do is to focus on coding instead of physics. And even if you do insist on getting heavily into programming, understanding computer science better really has very little to do with learning more languages. Languages are interchangeable. They all do pretty much the same thing.
 
You should focus less on which language you learn, and more the methods that are used to solve the complicated problems that need computers, as well as their pseudo-code implementation. In other words, you should be able to write in (engineering/physics) english how you will solve a problem.

I've worked in computational plasma physics as a graduate student for over a year and a half now, and I rely heavily on Python and MATLAB. If you want to do something relatively complicated (something it would take one person ~1 month to do) then C/C++ come in very handy. Anything that is extremely complex though (modeling a whole system) will require a code that has been developed for many years (even decades). L3 has a code as well as the Air Force Research Lab.
 
  • Like
Likes 1 person
Hey, I am Andreas from Germany. I am currently 35 years old and I want to relearn math and physics. This is not one of these regular questions when it comes to this matter. So... I am very realistic about it. I know that there are severe contraints when it comes to selfstudy compared to a regular school and/or university (structure, peers, teachers, learning groups, tests, access to papers and so on) . I will never get a job in this field and I will never be taken serious by "real"...
Yesterday, 9/5/2025, when I was surfing, I found an article The Schwarzschild solution contains three problems, which can be easily solved - Journal of King Saud University - Science ABUNDANCE ESTIMATION IN AN ARID ENVIRONMENT https://jksus.org/the-schwarzschild-solution-contains-three-problems-which-can-be-easily-solved/ that has the derivation of a line element as a corrected version of the Schwarzschild solution to Einstein’s field equation. This article's date received is 2022-11-15...

Similar threads

Back
Top