Programs Best Way for a Physics Major to Learn Fortran?

Click For Summary
A physics major is preparing to join a theory group that utilizes FORTRAN for complex calculations, having already mastered Python. Recommendations for learning FORTRAN include using any available resources and tackling problems from Numerical Recipes to gain practical experience. The specific version of FORTRAN used by the group is important, as there are significant differences between versions like FORTRAN 77 and newer iterations. The discussion emphasizes that FORTRAN remains relevant in scientific computing and that hands-on practice is crucial for mastering the language. Overall, the student is encouraged to immerse themselves in FORTRAN over the summer to be well-prepared for the upcoming research.
Dr. Courtney
Science Advisor
Education Advisor
Insights Author
Messages
3,306
Reaction score
2,531
A physics major I'm mentoring has been invited to join a theory group that makes heavy use of FORTRAN in their calculations. The student already knows Python and is adept at using it including integrating diff eqs and solving various challenging 1st year physics type problems. This theory group uses FORTRAN for classic LAPACK, LINPACK, Numerical Recipes, and the like (more modern algorithms for the same kind of stuff) in highly optimized codes running on big, fast computers.

It's been 30 years since I learned FORTRAN, and while it is easy to Google up a number of different online learning options, most of the students I mentor are more on the experimental side, so I'm not really sure how to sort through the options and give good advice. In the absence of better advice, I'd tend to recommend learning the language with any source the student can stand then throwing a few problems at them to beat into submission with Numerical Recipes. But I'm hoping someone here has more concrete experience with the available options so the student can come up the learning curve over the Summer and hit the ground running with the research group when the Fall semester starts.
 
Physics news on Phys.org
Dr. Courtney said:
The student already knows Python and is adept at using it including integrating diff eqs and solving various challenging 1st year physics type problems.
After you become comfortable with one programming language, learning a second one is much easier. You already understand that basic concepts of iteration, making choices, calling functions/subroutines, and such -- it's then ust a matter of learning the syntax of doing these things in a different light.

Dr. Courtney said:
This theory group uses FORTRAN for classic LAPACK, LINPACK, Numerical Recipes, and the like (more modern algorithms for the same kind of stuff) in highly optimized codes running on big, fast computers.
Sounds like he/she is already familiar with using numpy or one of the other computing libraries, so he/she most likely grasps how to set up the parameter prior to calling the routine you want.

Dr. Courtney said:
I'd tend to recommend learning the language with any source the student can stand then throwing a few problems at them to beat into submission with Numerical Recipes.
This sounds like a reasonable approach to me.

I don't have any further advice, but it would be helpful to know what flavor of Fortran the theory group is using -- Fortran 77 (they have to be using a newer version, I would hope), Fortran 90, Fortran 95, or one of the newer versions such as Fortran '03, '08, or even '18? There are significant differences in this range of versions, not that I have much familiararity with anything past '95.

Despite what a lot of people think, Fortran has not gone away, and is used in a lot of scientific computing.
 
The best way is to use FORTRAN to solve problems of increasing complexity all summer. The more exposure your student gets, the better.

At least it is easier than when I was a student. When I learned, we had to go to a computer center, punch cards and have them read into a mainframe. IBM360. If we used more than 40 dollars in computer money, we had to ask the professor for more, if we had a good reason.

Now the student can learn on his computer at home; a starbucks or whatever, and have almost infinite computer resources.

It took me years to learn FORTRAN, but the exponential increase in knowledge occurred when I bought my first PC in 1992. My first software purchase (the same day) was a FORTRAN compiler. (In those days you could buy them for 400 dollars from COMPUSA). After that, I could immerse myself totally.
 
mpresic3 said:
At least it is easier than when I was a student. When I learned, we had to go to a computer center, punch cards and have them read into a mainframe. IBM360. If we used more than 40 dollars in computer money, we had to ask the professor for more, if we had a good reason.
That was my experience as well, in a class using Fortran that I took in 1980. Fortunately I had had a class (using PL/C) several years before, so I understood the drill -- use a card punch machine to type the lines of your code, add JCL (job control language) cards to the front and back of your card deck, and submit your job. Come back the next day to see whether your code ran or not.

mpresic3 said:
It took me years to learn FORTRAN, but the exponential increase in knowledge occurred when I bought my first PC in 1992. My first software purchase (the same day) was a FORTRAN compiler.
My first computer, an Apple //e, was in '82, and I bought my first PC in '87 (with a Commodore Amiga in between). By that time I was teaching classes in C and in Fortran, so I had the Mix C compiler (about $30) and the Lahey Fortran compiler (about $90, as I recall). Being able to write code on your own computer made all the difference in the world.
 
FORTRAN 77 was my first language as an undergraduate in the early 1970s. It was my only language during graduate school, where it was my "bread and butter" as a research assistant. For several years in the late 1980s and early 1990s I taught an introductory course in it. I'm surprised to see that the textbook is still available, in both FORTRAN 77 and FORTRAN 90 versions:

FORTRAN 77 for Engineers and Scientists with an Introduction to FORTRAN 90, 4th edition (Nyhoff and Leestma)

FORTRAN 90 for Engineers and Scientists, 1st Edition (Nyhoff and Leestma)

You can probably find other editions and versions on Amazon, including used copies, if you search a bit. It worked OK for me and my students, back then. It doesn't assume any programming experience, so it may be overkill for a student who already knows Python. On the other hand, it would probably make a decent reference, supplemented with web searches.
 
Last edited:
There is a school of thought that says that the key to programming is to know a bunch of languages. Many colleges set up their programs (no pun intended) this way, I think a better approach is to learn programming - e.g. data structures, algorithms, etc. Then it becomes much easier to pick up the implementation language,
 
TL;DR: Jackson or Zangwill for Electrodynamics? Hi, I want to learn ultrafast optics and I am interested in condensed matter physics, ie using ultrafast optics in condensed matter systems. However, before I get onto ultrafast optics I need to improve my electrodynamics knowledge. Should I study Jackson or Zangwill for Electrodynamics? My level at the moment is Griffiths. Given my interest in ultrafast optics in condensed matter, I am not sure which book is better suited for me. If...

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
Replies
12
Views
3K
  • · Replies 30 ·
2
Replies
30
Views
3K
Replies
2
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
Replies
41
Views
7K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 2 ·
Replies
2
Views
429