Programing language for quantum mechanics, optics or plasma.

Click For Summary

Discussion Overview

The discussion revolves around the choice of programming languages suitable for computational physics, specifically in the fields of optics, quantum mechanics, and plasma physics. Participants explore various programming languages and software tools, considering their applicability and advantages in these areas.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants suggest that the choice of programming language depends on the specific application, with MATLAB, Mathematica, and Maple being favored for quick analysis and visualization tasks.
  • Others argue that Python is becoming a popular choice due to its versatility, open-source nature, and strong visualization tools, potentially supplanting traditional software like MATLAB.
  • There is a viewpoint that for complex data analysis pipelines, compiled languages like C or Fortran are preferred for their performance and control over numerical accuracy.
  • One participant emphasizes the importance of knowing a symbolic/visualization tool, a quick interpreted language like Python, and a compiled language for intensive computations, recommending C if the user already has basic knowledge of it.
  • Another participant notes that the choice of language may also depend on the community or environment one is in, suggesting that learning enough computer science can facilitate switching between languages.
  • Some participants highlight the need to focus on problem-solving methods rather than just the programming language itself, advocating for a strong understanding of the underlying computational techniques.

Areas of Agreement / Disagreement

Participants express a range of opinions on the best programming languages for computational physics, with no clear consensus. While some advocate for specific languages, others emphasize the importance of adaptability and understanding methods over language preference.

Contextual Notes

Participants mention various programming languages and tools without resolving the debate over their relative merits. There are references to specific applications and personal experiences, but no definitive conclusions are drawn regarding the best choice for all scenarios.

Who May Find This Useful

This discussion may be useful for physics students and professionals interested in computational physics, particularly those exploring programming languages and tools for optics, quantum mechanics, or plasma 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   Reactions: 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   Reactions: 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   Reactions: 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   Reactions: 1 person

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 12 ·
Replies
12
Views
2K
Replies
10
Views
3K
Replies
1
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 15 ·
Replies
15
Views
3K