|SPY HILL Research||
|Poughkeepsie, New York||
This is the Home Page for an independent study reading course in Fortran and Unix for Physics and Astronomy students.
The only real way to learn to program is by writing programs, so the course is structured around a set of simple exercises. Each exercise requires that you learn one or more new programming concepts in order to complete that exercise. Once your program works correctly, you can move on to the next exercise.
The latest version of Fortran is Fortran 90, so why does this course use Fortran 77?
First of all, Fortran 90 includes Fortran 77 as a subset, so by learning Fortran 77 you are actually learning the basics of Fortran 90 too. But Fortran 90 also includes extra language elements for manipulating arrays and matrices, and new control structures. These are useful, especially for problems which have to be run on the latest supercomputers, but they can also be confusing for beginners. It is better to start with simpler ideas and work your way up. So you should start by learning Fortran 77, and then later learn the more powerful and specialized constructs of Fortran 90.
A second reason for using Fortran 77 is that Fortran 77 compilers are available everywhere, on all kinds of computers. Many Unix computers come with the f77 compiler included for free, or you can get the GNU Fortran compiler (g77) from the Net for free. In contrast, Fortran 90 compilers are not as widely available right now, and they generally cost extra. (Of course if all you have is a Fortran 90 compiler, it should work fine on Fortran 77 code.)
Some people say it's better to learn C or C++. Why not learn those instead of Fortran?
First of all, Fortran is the easier language to learn, and it is specially designed for scientific and engineering applications. That means you can start immediately to write programs that do useful calculations for your research or classwork. Fortran has continued to be a language used many major scientific computing projects.
C and C++ are certainly both useful languages to know too, but they are a bit more complex and thus harder to learn. C is stricter about grammar and syntax than Fortran. A good way to learn C++ is to first learn C; And for scientists, the best way to learn C is usually to learn Fortran first, as long as you also learn proper style and develop good habits designed to carry over to C. The grammar and style suggestions given in this course are all designed to develop proper programming methods and good habits, so that you can then go on to learn C, and perhaps C++, or any other programming language you may need.
It is possible for you to work through the exercises yourself,
without an instructor, but that is not the most effective way to
Instead, you should have an instructor, or "mentor," who can answer your questions and give you suggestions and guidance while you are writing your programs, and who can read through your programs when they are finished to be sure that they actually meet the requirements of the exercise (see below).
Choose your instructor wisely (if you have a choice). You do not want someone who knows only the technical aspects of Fortran. Just as there is more to writing good prose than obeying the rules of grammar, there is more to writing good computer code than obeying the rules of the language syntax. A good instructor will also give you valuable lessons about proper "style", and may also let you in on some of the tricks that can help you become a master programmer.
The entire course consists of 16 lessons. Here is how each lesson works in practice:
Continue on to the list of exercises...
|Last modified: Tuesday March 20, 2012||Copyright © 2012 by Spy Hill Research||http://www.spy-hill.com /~myers/fortran/index.html|