Best Way for a Physics Major to Learn Fortran?

In summary: FORTRAN compiler). It is definitely easier now than it was then. There are a lot more resources available, both online and in books.
  • #1
Dr. Courtney
Education Advisor
Insights Author
Gold Member
3,307
2,530
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
  • #2
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.
 
  • #3
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.
 
  • #4
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.
 
  • #5
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:
  • #6
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,
 

1. What is the importance of learning Fortran as a physics major?

Fortran is a key programming language used in scientific and engineering fields, making it a valuable skill for a physics major. Many research projects and simulations are written in Fortran, and having knowledge of this language can open up opportunities for future employment in these industries.

2. How does Fortran differ from other programming languages?

Fortran is a high-level, compiled programming language specifically designed for scientific and numeric computing. It has a strong focus on mathematical operations and is known for its speed and efficiency in handling large datasets. Unlike other languages, Fortran uses static memory allocation, which can be beneficial for scientific applications.

3. What are the best resources for learning Fortran as a physics major?

There are many online resources available for learning Fortran, including tutorials, documentation, and practice problems. Some popular resources include the Fortran Wiki, Fortran90.org, and the Fortran Market. Additionally, many universities offer courses or workshops on Fortran as well.

4. What are some tips for effectively learning Fortran as a physics major?

One of the best ways to learn Fortran is to practice writing code and solving problems on a regular basis. It is also helpful to familiarize yourself with the syntax and structure of the language, as well as its common libraries and functions. Additionally, seeking guidance from experienced Fortran users or joining online communities can provide valuable insights and support.

5. How can I apply my knowledge of Fortran as a physics major?

As a physics major, you can use your knowledge of Fortran to write and run simulations, analyze data, and create models for various research projects. Additionally, many companies and organizations in the scientific and engineering fields may require Fortran skills for their projects, making it a valuable asset for future job opportunities.

Similar threads

  • STEM Academic Advising
Replies
8
Views
1K
  • STEM Academic Advising
Replies
30
Views
2K
  • STEM Academic Advising
Replies
13
Views
2K
  • STEM Academic Advising
Replies
6
Views
157
  • STEM Academic Advising
Replies
9
Views
1K
  • STEM Academic Advising
Replies
7
Views
1K
  • STEM Academic Advising
Replies
6
Views
1K
  • STEM Academic Advising
Replies
6
Views
1K
  • STEM Academic Advising
Replies
6
Views
1K
Replies
5
Views
1K
Back
Top