Index and description of example Fortran programs used in the course

The following is a listing and description of the example programs used in Comp Sci 201 (Fortran).

A Bulgarian translation of this page is available courtesy of

Program name:

What it does:

add.f Adds 2 numbers
add2.f add.f using SUBROUTINEs and a MODULE
aorder.f Demonstrates the storage order of a Multi-dimensional array, also the use of the EQUIVALENCE statement.
arith.f Demonstrates the arithmetic assignments such as order of operations and mixed mode operations. Also uses the DATA statement
arithp.f Demonstrates the arithmetic assigments using parentheses and the PARAMETER statement.
array1.f Demonstrates use of arrays for data analysis-max, min, and average and use of formatted output.
array1s.f Same as array1.f except uses subroutines for data analysis. Demonstrates how to pass arrays between the main program and subprograms.
array2.f Demonstrates the use of arrays with Fortran 90 specifications.
array2s.f Same as array2.f except it uses subroutines for data analysis and Fortran90 size declarations.
array2se.f Same as array2.fand array2s.f except it uses subroutines and Fortran 77 array size declarations.
array2sf.f Another rewrite of array2.f.
array3.f Demonstrates the use of the ALLOCATE statement for declaring arrays of unknown size.
array3a.f Program very similar to array3.f but examines the input data file to determine the size of the input array. Examines input file
array3as.f Same program as array3a.f except it demonstrates the use of the ALLOCATE statement with subroutines.
array3b.f Another use of the ALLOCATE statement determining the size from the input file. Uses the input file
array3c.f Another array program for arrays of unknown size using Fortran 77's PARAMETER statement rather than ALLOCATE.
array3e.f Array program which demonstrates the MISUSE of the ALLOCATE statement.
associated.f Demonstrates the use of pointers and targets and tests their association.
clobber.f Illustrates the pitfalls of poorly indexing arrays.
debug.f Heat Transfer Coefficient program with errors which need to be fixed.
debug1.f Demonstrates the debugging process.
dimtest.f Tests the DIM option for the Fortran 90 intrinsic functions sum, minval, and maxval for use with arrays. Associated with sample output dimtest.out.
dual-errors.f Example of the use of the INTERFACE structure creating a generic function interface.
dual-interface.f Demonstrates the use of the INTERFACE structure which creates a generic function which can be used with both real and integer values.
errors.f Program with several errors due to the poor location of statements.
format.f Demonstrates the many uses of the Format statement. Generates sample file format.out.
funspeed.f Program similar to speed.f which uses functions to do all of the calculations.
gp-int1 Demonstrates use of gnuplot to graph data from two input files. Sample gnuplot input file.
gp-int2 Another sample gnuplot input file.
gp-int3 " " "
grades1.f Program which uses arrays and subroutines to calculate and store grades. Associated with
htcoef.f Program which calculates approximate heat transfer coefficients for a 1 inch pipe for several Reynolds numbers.
htcoef1.f Same as htcoef.f except it calls a function to do the calculations.
htcoef2.f Same as htcoef.f except it demonstrates the fact that variables of the same name in the main program and subprograms can have different values.
htcoef3.f Program very similar to htcoef1.f and htcoef2.f which uses an exponentiation trick to increase the speed.
iftests.f Shows the many uses of the IF statement.
inter1.f Demonstrates 2 simple methods of interpolation (linear and cubic) for smoothly joining results from 2 disjoint regions.
inter2.f Same as inter1.f except interpolates different data.
inter3.f Similar to inter1.f and inter2.f but uses a weighted transition.
interface.f Demonstrates the use of the INTERFACE structure which allows the use of FUNCTIONS with arrays.
linint1.f Subroutine which interpolates y-values given an x-value and a table of y-values.
linint2.f Subroutine similar to linint1.f but uses tables of x and y values.
linint3.f Subroutine similar to linint1.f and linint2.f but more efficient.
linint4.f Subroutine similar to linint1.f , linint2.f, and linint3.f but even more efficient.
mathin Sample file of Mathematica commands.
matprod.f Multiplies two matrices together.
module.f Demonstrates the use of the MODULE structure within a main program and its subprograms.
newton1.f Sample program using NEWTON ITERATION to solve an equation.
newton2.f More complicated version of newton1.f which uses statement functions and do loops.
noadv.f Demonstrates the use of the NO ADVANCE option on READ and WRITE.
pawsum.f Array program which uses MAX, MIN, implied DO loops, DATA statements, and other Fortran 90 constructs.
plot1.f Plots sine function.
plot2.f Program similar to plot1.f except subroutines are used. Illustrates EXTERNAL and INTRINSIC statements
pointers.f Demonstrates the use of pointers to manipulate sections of arrays. Generates the file pointers.out
ranges.f Displays the smallest and largest absolute values that can be represented with each of several data types. Uses Fortran 90 statements TINY and HUGE.
secant.f Uses secant iteration to find the roots of an equation. Compares solution to Newton Iteration of same equation.
sifunc.f Introduction to the statement function.
speed.f Times three different methods of calculating the dot product of long vectors.
speedf.f Program similar to speed.f.
sums.f Demonstrates the Fortran 90 SUM function with the MASK option.
trig.f Calculates the SIN and COS of an angle given in degrees.
where.f Demonstrates the use of WHERE, ELSE WHERE, and END WHERE.
Ordinary Differential Equation Programs
fall.f Calculates the dynamics of a falling body.
fall1.f Program similar to fall.f but introduces MODULES.
fall2.f Calculates the dynamics of a falling body attached to a spring.
fall3.f Program similar to fall2.f but give an answer that is second order accurate (proportional to dt**2)
odeint.f Demonstrates the use of Runge-Kutta, Adams-Bashford, and Adams-Moulton methods for solving ODEs
Curvefit Programs
quad.f Performs a Quadratic spline fit to a specified data file (with .txt extension)
rholiq.f Subroutine which evaluates the density of Freon and its derivatives with respect to other properties.
satprs.f Function which evaluates the saturation pressure of Freon as a function of saturation temperature.
thcl.f Function which evaluates the liquid thermal conductivity of Freon as a function of enthalpy.
viscl.f Function which evaluates the liquid dynamic viscosity as a function of liquid enthalpy and pressure.
Integration Programs
trapezoid.f Program which demonstrates the Trapezoidal rule of integration.
trapz1.f Program similar to trapezoid.f which uses the file trapcom.h through an INCLUDE statement .
trapz2.f Program similar to trapezoid.f which uses a MODULE.
Programs using Character Variables
charvar.f Program which demonstrates the use of character variables in Fortran 77.
charvr90.f Program whic demonstrates the use of character variables in Fortran 90.
Programs associated with Least Squares Fit
gendata.f Creates fake experimental data with a random error.
lin1.f Program which tests linear equation solvers and sets up a 6x6 system of linear equations. Generates the file lin1.out
lsq.f Program which performs a least squares fit of a quadratic equation to given data. This particular program gives the location of a falling object at various times. Associated with the file
lsq2.f Program similar to lsq.f which takes advantage of Fortran 90 statements.
lsq3.f Program similar to lsq.f which uses code that is optimized for parallel or vector processors.
quadfit.f Program which takes data from two arrays and fits them to a quadratic equation.
Programs associated with Sorting Data
drvsort.f Program which drives sorting subroutines.
sort1.f Example of a SELECTION SORT using Fortran 90.
sort2.f Example of a BUBBLE SORT.
sort3.f Example of an INSERTION SORT.
sort3a.f Example of an INSERTION SORT using Fortran 90 Functions.
sorthalf.f Sorts an array also making the same interchanges in an auxiliary array. Array can be sorted in increasing or decreasing order.
sortout Test of all sorting subroutines.

Back to the 201 homepage.