Some notes on Numerical Recipes in Fortran 90
Why fortran 90
First of all, I started working in Fortran 77 (F77) several years ago involved in numerical analysis for my doctoral thesis on fluid mechanics. What I did back in those years began with slight modifications to already tested, very large, F77 programs. Since, we were more interested in a boundary value problem than with the program itself I did not pay too much attention to how those programs work.
For short, those programs were based un routines from the Numerical Recipes book for F77. It seemed to me easy to connect the routines to a main program!. However, it was not. I was terribly wrong. Also, I was involved with Maple for analytical calculations and later I started programming numerical calculations on that software leaving F77 as something obsolete. I was wrong again.
I has found some problems that need numerical treatment and even the strong built-in functions or commands of Maple consume too much time. My conclusion is that more work on the numerical programming should be done. In fact that sentence of written by Press, Teukolsky, Vetterling and Flannery in their book title came back to me as an inescapable reality: scientific computing is an art.
For me, there are two options to go ahead with numerical analysis of more complex problems in reasonable time:
- to change from Maple to other software tool more efficient,
- to buy a more powerful computer in order to overcome hardware and computational time needs for large numerical tasks.
I think that there are very important lessons from the programming style and examples in Numerical Recipes that can be adapted to programming in Maple so that higher efficiency can be achieved on it. On the other hand fortran continue being a powerful tool for researchers involved in numerical analysis and you find plenty of information over the internet, excelent books and good examples too for Fortran 90 (F90). Despite the existence of newer versions of fortran I preferred F90 because of the availability of information and compilers.
Resources to begin with F90 and Numerical Recipes for F90
I started with a book I know since several years ago devoted to explain how to use F77 with examples and in a very didactic fashion. This was Fortran 77 for engineers and scientists by Larry R. Nyhoff and Sanford Leestma. However, when I dediced to get fully involved with f95 I changed to Fortran 90 for engineers and scientists by the same authors which is well written too.
Despite several years as linux user I have to used several other softwares native of Windows. In the end, I found myself switching to Windows in full. At the same time, I got tired of using cygwin to access the gnu compiler, through the terminal, and begun looking for another option on windows to run fortran.
I returned to
The Fortran Company who sells Fortran Tools with a very convenient IDE fortran compiler along with other useful softwares. In this way, I did not need to remember or recover compilation commands and options through the terminal, although Fortran Tools gives this option too.
Another important reference is Fortran 95. Using F by Walter S. Brainerd, Charles H. Goldberg and Jeanne C. Adams from the Fortran Company. I found this book very handy beacuse of the examples and the explanations on the program structure. This book works very well with that of Nyhoff and Leestma.
Since, I intended to work with Fortran Tools the software manual is very important to corretly set the compilation options of the program. The above references were key to start with F90 for me or at least for someone that have not take a formal course on scientific programming with fortran.
If you know very little about fortran and go directly to Numerical Recipes with F90 (NR) you will probably understand very little of how to get running a numerical method since NR only have subroutines. Fortunately, Press, Teukolsky, Vetterling and Flannery also wrote another book to ease the use of the subroutines in the first one: Numerical Recipes. Example book (Fortran). However, this last book was devoted to F77 and further versions of fortran have not been considered.
Finally, I should mentioned that scientific computing may differ a little with regular undergraduate courses on numerical methods (just take a look of the content of NR). You may consider the algorithms and program implementations in the book of Numerical Methods for Engineers by Steven Chapra and Raymond Canale and compare it with what is proposed by Press, Teukolsky, Vetterling and Flannery.
Any questtion? Write in the comments and I shall try to help.
=========
Ildebrando
No comments:
Post a Comment