Computational Skills for Theoretical Physics

  • Studying
  • Thread starter Falgun
  • Start date
  • #1
14
4
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.
 

Answers and Replies

  • #2
Gaussian97
Homework Helper
520
277
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
wle
332
154
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
14
4
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
14
4
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 learnt later.
 
  • #6
wle
332
154
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.
 
  • #7
2
2
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
2
2
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

Related Threads on Computational Skills for Theoretical Physics

  • Last Post
Replies
0
Views
1K
Replies
1
Views
2K
Replies
21
Views
7K
  • Last Post
Replies
0
Views
2K
Replies
5
Views
2K
Replies
6
Views
4K
Replies
8
Views
20K
Top