# Computational Fortran books/resources for beginners

Tags:
1. Apr 27, 2017

### Whitehole

I have a background of undergraduate physics but I consider myself to be quite weak in programming. I'm aware of the usefulness of computational software/programming software in the sciences, particularly physics. I'd like to ask for recommendations on how to start learning fortran assuming I have little to no knowledge about programming. It's better if for example the book applies it to mathematics or physics problems.

Also, what is the difference between the fortrans that I see, can anyone give me a brief background on this?

2. Apr 27, 2017

### hilbert2

3. Apr 27, 2017

### Staff: Mentor

There are some good tutorials available on-line. Google "fortran tutorial".

As for the different flavors of Fortran, you should know that Fortran has a long history dating back to the time of punch cards. Fortran 77 still uses a fixed column format for program input, in keeping with what one would have to do with a punch card. Except for maintaining legacy code, no-one should be programming like this anymore, so you should learn Fortran 90 (or newer incarnations). The differences between Fortran 90, 95, and later implementations is minimal, and certainly not important for a beginner.

4. Apr 27, 2017

### Whitehole

Thanks for that resource, but how does Fortran really work? For example in Mathematica, suppose I have a set of DE's and I want to get the solution to those DE's because I want to get the value of a quantity that depends on those solutions. You can solve the system of differential equations using NDSolve, then we can store the solutions to some variable then plug into the corresponding quantities, i.e.

sol = NDSolve[{y''[t] + y'[t] + y[t] ==0, p' + p == y'[t], y[0]==1, y'[0]==1, p[0]==2}, {y, p}, {t, to, tf}]

ysol[t] /. sol
y'[t] /. sol
p[t] /. sol

F(y,y',p):= some expression

then we can plot F.

I'm trying to search on how to solve DE's in Fortran but all I see are just numerical techniques applied in Fortran. So how is Fortran different from Mathematica in this aspect?

5. Apr 27, 2017

### hilbert2

Programming languages like C or Fortran don't understand symbolic formulae like differential equations, and don't know how to simplify expressions, as in $(x^2 - 1)/(x+1) = x-1$. If you want to use Fortran to tell the computer how to solve a differential equation, you have to reduce the solution process to a sequence of very basic arithmetic operations (summing, multiplication, division). This is how real programming languages differ from something like Mathematica.

6. Apr 27, 2017

### Whitehole

Thanks for that information!