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
I’ve been looking through the curricula of several European theoretical/mathematical physics MSc programs (ETH, Oxford, Cambridge, LMU, ENS Paris, etc), and I’m struck by how little emphasis they place on advanced fundamental courses. Nearly everything seems to be research-adjacent: string theory, quantum field theory, quantum optics, cosmology, soft matter physics, black hole radiation, etc. What I don’t see are the kinds of “second-pass fundamentals” I was hoping for, things like...
TL;DR Summary: I want to do a PhD in applied math but I hate group theory, is this a big problem? Hello, I am a second-year math and physics double major with a minor in data science. I just finished group theory (today actually), and it was my least favorite class in all of university so far. It doesn't interest me, and I am also very bad at it compared to other math courses I have done. The other courses I have done are calculus I-III, ODEs, Linear Algebra, and Prob/Stats. Is it a...

Similar threads

Back
Top