Computational Skills for Theoretical Physics

In summary, the conversation discusses the speaker's experience with learning to code and their interest in pursuing a theoretical physics major. They ask for recommendations on scientific computing software and programming languages, and the other person suggests learning whatever is most interesting and being aware of the quirks of floating-point arithmetic. They also share their own experience with using Python and Fortran for programming in physics and recommend those languages.
  • #1
Falgun
73
44
I am currently learning to code by auditing Harvard's CS50 course on edx. I am mainly interested in pursuing a theoretical physics major in the future. What I would like to know which scientific computing software/language (as in OCTAVE, SCILAB, FORTRAN, JULIA, etc ) can I learn alongside which will benefit me the most?
Also , please recommend software which is free as it is difficult to afford high end products for me.

Thanks in Advance.

P.S. I am relatively new here so sorry if I was supposed to post somewhere else.
 
Physics news on Phys.org
  • #2
Well, I don't know if my experience will be good advice for you or not, but here's my case (I'm now doing a PhD in phenomenology QCD)

I only know Python programming language, and I've never had any problem. Python seems a very popular option, not just in the physics world but in computing in general. And I'm completely satisfied with my choice.
The main problem with Python is the one anyone will tell you, it is slow. So, to be fair, I'm now using Python when I need to do programming, but absolutely 100% of the programs I write are based on libraries written in Fortran. I also have mates that don't know Python and use Fortran directly, so Fortran may also be a really good option, and it seems that a lot of numerical simulation are written in Fortran.

So, for my experience, I would recommend Python or Fortran. Just mention that I'm a physicist and I don't really program very much so this answer should have 0 credibilities. I'm just telling you my experience which surely is biased in lots of ways.

As a final thought, I would say that Fortran maybe is the purest language you can use. But it seems to me that, given that almost any library you want is also available in Python I think Python is much more flexible in other things that it is worth sacrificing the Fortran speed.

Hope that helps and that somebody more experienced can give you better advice.
 
  • Like
Likes JD_PM and BvU
  • #3
Falgun said:
I am currently learning to code by auditing Harvard's CS50 course on edx. I am mainly interested in pursuing a theoretical physics major in the future. What I would like to know which scientific computing software/language (as in OCTAVE, SCILAB, FORTRAN, JULIA, etc ) can I learn alongside which will benefit me the most?
I honestly wouldn't worry about this too much. Just learn whatever and as much as you find interesting. Other than having a working knowledge of LaTeX there isn't really any set of computing skills that all physicists have to know. Depending on what you actually do in theoretical physics you may be able to largely avoid programming or it may be your main way of getting results, or anything in between. If you do end up having to do much programming you may have the freedom to choose what programming language(s) you use or it may be practically dictated by what other people in the field or your research group use. You won't know these things until you know what kind of research in theoretical physics you will actually be doing. But I think if you learn any amount about programming out of personal interest you'll know more than you need to do any scientific computing you might have to deal with in the future.

That said, if you're going to do numerical work, you really want to make sure you're aware of the various quirks and pitfalls of floating-point arithmetic.
 
  • #4
Gaussian97 said:
Well, I don't know if my experience will be good advice for you or not, but here's my case (I'm now doing a PhD in phenomenology QCD)

I only know Python programming language, and I've never had any problem. Python seems a very popular option, not just in the physics world but in computing in general. And I'm completely satisfied with my choice.
The main problem with Python is the one anyone will tell you, it is slow. So, to be fair, I'm now using Python when I need to do programming, but absolutely 100% of the programs I write are based on libraries written in Fortran. I also have mates that don't know Python and use Fortran directly, so Fortran may also be a really good option, and it seems that a lot of numerical simulation are written in Fortran.

So, for my experience, I would recommend Python or Fortran. Just mention that I'm a physicist and I don't really program very much so this answer should have 0 credibilities. I'm just telling you my experience which surely is biased in lots of ways.

As a final thought, I would say that Fortran maybe is the purest language you can use. But it seems to me that, given that almost any library you want is also available in Python I think Python is much more flexible in other things that it is worth sacrificing the Fortran speed.

Hope that helps and that somebody more experienced can give you better advice.
Actually the CS50 course includes C , Python, SQL, HTML, CSS, JavaScript.

So I was wondering if it would be beneficial to learn something like mathematica, maple, matlab, octave or something.
 
  • #5
wle said:
I honestly wouldn't worry about this too much. Just learn whatever and as much as you find interesting. Other than having a working knowledge of LaTeX there isn't really any set of computing skills that all physicists have to know. Depending on what you actually do in theoretical physics you may be able to largely avoid programming or it may be your main way of getting results, or anything in between. If you do end up having to do much programming you may have the freedom to choose what programming language(s) you use or it may be practically dictated by what other people in the field or your research group use. You won't know these things until you know what kind of research in theoretical physics you will actually be doing. But I think if you learn any amount about programming out of personal interest you'll know more than you need to do any scientific computing you might have to deal with in the future.

That said, if you're going to do numerical work, you really want to make sure you're aware of the various quirks and pitfalls of floating-point arithmetic.
Thanks for clarifying. Then what would be the bare minimum you would expect an undergrad to know i.e. what would be useful to a physics major.

My main motivation was that I'll be self learning a lot of physics and there are some problems which we are expected to solve using a computer. So what would an undergrad typically use for such things.

As for Latex I don't really have to submit homework so that can be learned later.
 
  • #6
Falgun said:
Thanks for clarifying. Then what would be the bare minimum you would expect an undergrad to know i.e. what would be useful to a physics major.
Very little. Certainly less than you say you'll be learning from the course you say you'll be following. In physics most people see computing/programming skills as something that you just pick up and learn as needed. If you have a good understanding of C and Python then this won't be a problem.

My main motivation was that I'll be self learning a lot of physics and there are some problems which we are expected to solve using a computer. So what would an undergrad typically use for such things.
Probably Matlab; Octave is about the closest to this that is free software. Mathematica (or a free alternative like Maxima) if they want to do symbolic work. You might find more computer-literate undergrads using Python or whatever their personal favourite programming language is.
 
  • Like
Likes Falgun
  • #7
One of my students recently did a research project to find out the most popular programming languages or software in the Physics discipline. The first turned out to be MATLAB, the second was Fortran. The third, but with a significant distance from Fortran and MATLAB was Python. All said you would want to learn a language that your research group uses in their research.

Particle physicists mostly use Python combined with C/C++. But the rest of the community pretty much uses MATLAB or Fortran. Fortran and MATLAB are highly similar in their syntax and perfect languages for vectorized numerical computing and mathematics. However, Fortran is 100 to 500 times faster than both Python/MATLAB. If you decide to go with Fortran, I highly recommend beginning with the latest Fortran 2008 and 2018 standards, which have even native parallel computing built into the language in addition to all other things like Object-Oriented programming. Also, get help from the community of Fortran programmers on:

https://fortran-lang.discourse.group/

There are now even parallel Fortran Jupyter Notebook environments that enable the programmer to write Fortran code dynamically in Jupyter notebooks, just like Python/R.
 
  • #8
One of my students recently did a research project to find out the most popular programming languages or software in the Physics discipline. The first turned out to be MATLAB, the second was Fortran. The third, but with a significant distance from Fortran and MATLAB was Python. All said you would want to learn a language that your research group uses in their research. Particle physicists mostly use Python combined with C/C++. But the rest of the community pretty much uses MATLAB or Fortran. Fortran and MATLAB are highly similar in their syntax and perfect languages for vectorized numerical computing and mathematics. However, Fortran is 100 to 500 times faster than both Python/MATLAB. If you decide to go with Fortran, I highly recommend beginning with the latest Fortran 2008 and 2018 standards, which have even native parallel computing built into the language in addition to all other things like Object-Oriented programming. Also, get help from the community of Fortran programmers on: https://fortran-lang.discourse.group/
There are now even parallel Fortran Jupyter Notebook environments that enable the programmer to write Fortran code dynamically in Jupyter notebooks, just like Python/R.

Free software: Some of the best industry-level Fortran compilers are now free of charge and have the full or nearly full support of Fortran 2018:
Intel Fortran compiler: Supports full Fortran 2018. It takes only a few lines of commands in a terminal to install the Intel Fortran compiler all for free: https://fortran-lang.discourse.group/t/intel-releases-oneapi-toolkit-free-fortran-2018/471/58
GNU Fortran compiler: Supports most of Fortran 2018. As before, free and easy to install on all platforms.
NVIDIA Fortran Compiler: Supports full Fortran 2003 and much of F2008 and F2018. Free community edition available: https://docs.nvidia.com/hpc-sdk/index.html
NAG Fortran compiler: not free, as far as I know, but supports full Fortran 2018: https://www.nag.com/content/nag-fortran-compiler
 
  • Like
Likes Falgun and BvU

1. What are computational skills for theoretical physics?

Computational skills for theoretical physics involve using mathematical and computational tools to model and solve complex problems in physics. These skills are essential for studying and understanding theoretical concepts in physics.

2. Why are computational skills important for theoretical physics?

Computational skills are important for theoretical physics because they allow physicists to analyze and simulate complex systems and phenomena that cannot be solved analytically. These skills also help in making predictions and testing theoretical models.

3. What are some common computational tools used in theoretical physics?

Some common computational tools used in theoretical physics include programming languages such as Python, MATLAB, and Fortran, as well as numerical methods like Monte Carlo simulations, finite element analysis, and computational fluid dynamics.

4. How can one improve their computational skills for theoretical physics?

One can improve their computational skills for theoretical physics by practicing regularly, taking courses in programming and numerical methods, and collaborating with other physicists who have strong computational skills. Reading and understanding code written by others can also be helpful.

5. Can computational skills be applied to other fields of science?

Yes, computational skills are not limited to theoretical physics and can be applied to other fields of science such as chemistry, biology, and engineering. Many scientific disciplines rely on computational tools for data analysis, modeling, and simulations.

Similar threads

Replies
37
Views
3K
Replies
2
Views
951
  • STEM Academic Advising
Replies
5
Views
250
Replies
22
Views
1K
Replies
16
Views
1K
Replies
35
Views
3K
  • STEM Academic Advising
Replies
2
Views
1K
  • STEM Academic Advising
Replies
4
Views
2K
Back
Top