Some very simple examples that new Fortran 90/95* users may find useful:


Example of an array constructor

Example that reads a data file (data.txt) which contains an unknown number of data points

Example which shows the usage of preprocessor (my_header_file.h)

Example which shows the many ways in which a function can be defined

Example which shows the use of elemental procedures, defined for scalar arguments but are (conveniently) applicable to arrays

Example which shows the use of recursive procedures

Example which shows the use of derived data types

Example which shows the use of allocatable in derived data types

Example which shows how to load an intrinsic operator

Example which shows a custom operator being overloaded (Here's the same code but now illustrates the use of public/private attributes in modules)

Example which shows the use of the assignment (=) operator (Here's the same code but with public/private attributes)

Example which illustrates subroutine/function overloading

Example which shows how to a pass a procedure as an argument using external attribute

Example which shows the use of optional arguments in subroutines (also possible in functions)

Example (Solves Ax=b using the conjugate gradient method where 'A' is symmetric and positive definite; Here's the sparse version of the same code)

Example which shows the ~maximum memory in 'Mb' that can be allocated on your machine

Some examples which use popular numerical libraries like MKL (BLAS/LAPACK), ScaLAPACK/PETSc etc.

If you want to display Fortran code on web with syntax highlighting then you can use the ':TOhtml' command in Vim to create the html file (and this will look like this)

If you really have the need to display data graphically within a program then use a library like DISLIN (installation instructions are available here)

Finally, one of the many reasons why you should not use python for serious numerical computing ;-]


[*] Newer compilers (such as Intel 10.0, Sun Studio 12, IBM XL 9.1, gfortran, g95 etc.) support many new features of the 2003 Fortran standard. Refer to Chapman's or Metcalf, Reid and Cohen's latest book for Fortran 2003 specific examples.