CS 270 Home Page
Introduction to Numerical Computation
Spring 2008
This course has two main goals: to teach the student the basics of
programming in the Fortran 90/95 language and to use that language to find
numerical solutions to mathematical problems, especially problems of
interest in science and engineering. In order to do this, a good deal of time is spent on
studying elementary numerical analysis. Good software
engineering techniques are emphasized in the programming portions of the course.
Examples and Class Materials
Further Information
- The Course Syllabus
- Tentative Course Schedule

- Grading Guidelines
- CIS Lab Schedule
See when you can use the lab to do your homework.
- mathworld.wolfram.com
Contains a wealth of resources,
including some on numerical methods.
- Information on UNIX Editors
- For information on available commands on our Linux server, enter the following
at the comand prompt:
topic
topic 12
- See the Server Usage page
For information about our server and the software you can use to access it.
- The easiest way to compile a Fortran 90 program on our Linux system is as follows,
where we assume that the program is named
series.f90:
build90 series
The build90 script will link in the library of numerical subroutines if needed. It
will put the executable in a file with the name series (without the .f90).
You then run the program by entering ./series at the command prompt.
- Information on Well-known Series
- Power Series
- Fortran programs:
Anyone can copy these examples when viewing them in a browser. Students in this class
can also copy them at the commmand line as in the following two examples:
cp /users/cs270/trap1.f90 . (The dot is necessary. It represents the current directory.
Thus we will copy the file to the current directory. The filename will stay the same.)
cp /users/cs270/convert.f90 myconvert.f90 (This will copy to a new filename in
the current directory.)
- aboveavg.f90
Illustrates the use of a 1-dimensional array.
- arith1.f90
Prints the largest integer, the largest plus 1, etc.
- arith2.f90
Tries division by zero, etc.
- arith3.f90
Experiments with adding large and small numbers, as well as adding in different orders.
- average1.f90
Averages a list of numbers with 0 used to end data entry.
- average2.f90
Uses a WHILE loop to solve the same problem.
- bsectst1.f90
Uses bisection algorithm to find a zero of a function.
- bsectst2.f90
- bsectst3.f90
- convert.f90
Simple program to convert from Fahrenheit to Kelvin.
- deriv1.f90
Program to compute a derivative at a point.
- epsilon1.f90
Estimates the machine epsilon.
- epsilon2.f90
A minor variation on the previous program.
- epsilon3.f90
Shows how to use a subroutine.
- factorial.f90
Prints the factorial of each nonnegative integer entered.
- integ3.f90
Uses the numerical subroutine library to integrate sin(x) from 0 to pi.
- leqtest.f90
Uses Gaussian elimination with partial pivoting to solve a system of linear equations.
- leq.in
Input data file for the previous program.
- linear1.f90
Uses a library subroutine to solve a system of linear equations.
- linear2.f90
Solves a system of 3 linear equations in 3 variables via simple-minded elimination
and back substitution.
- looptest.f90
Finds the limits for integer and real loop control variables.
- machine1.f90
Looks up and prints the values of various machine constants.
- machine2.f90
Looks up and prints the values of some other machine constants.
- maxmin.f90
Finds where max and min are in a list of integers.
- multiply1.f90
Simply multiplies two numbers.
- multiply2.f90
Prints some products and quotients.
- newton3.f90
Uses Newton's method for finding a zero of a function.
- newraph3.f90
Uses Newton-Raphson method for finding a zero of a function.
- ode1.f90
Solves an ordinary differential equation via Euler's method.
- ode2.f90
Solves another ordinary differential equation via Euler's method.
- ode3.f90
Uses Taylor's series to solve an ordinary differential equation.
- ode4.f90
Uses Taylor's series to solve another ordinary differential equation.
- quadeq1.f90
Solves a quadratic equation via the quadratic formula.
- readfile.dat
Data file to accompany the following program.
- readfile.f90
Shows how to read numbers from a formatted file.
- series1.f90
Finds a partial sum of the series 1+ 1/2 + 1/4 + 1/8 +...
- series2.f90
Finds sin(x) for a particular value x by using the power series for sin(x).
- series3.f90
Uses an array so that terms can be added from smallest to largest.
- series8.f90
Program to investigate a Fourier series that converges to 1
on (-1, 1), to 0 at 1, to -1 on (1, 3), etc.
- series15.f90
Uses a Taylor's series approximation to integrate sin(x) from 0 to pi.
- sqroot.f90
Prints a table of square roots. More importantly, it shows
how to use a 1-dimensional array.
- subroutines.f90
Illustrates how to write and use subroutines. Really short subroutines
are used in this and the next two examples in order to keep the examples simple.
- subroutines2.f90
Illustrates how to write and use subroutines. This one has a subroutine
with an INOUT parameter.
- subroutines3.f90
Illustrates how to write and use subroutines. This one replaces one of the
subroutines in the previous two examples with a function.
- trap1.f90
Uses the trapezoidal rule to integrate sin(x) from 0 to pi.
- trap2.f90
Double precision version of trap1.f90.
Homework and Labs
Tests
- Final Exam:
- Thurs, May 8, 8:30 - 10:30 am
- Open book, open notes exam. Bring your handouts as you will need them to answer
several of the questions.
- Covers the numerical analysis topics of
power series (especially Taylor's series), Fourier series, systems of linear
equations, finding roots of non-linear equations (zeros of functions), numerical
integrations, approximating the value of a derivative at a point, and solving simple
ordinary differential equations.
- Also covers ch 5 (FORMAT statements, reading and writing files), ch 6 (arrays),
ch 7 (functions, subroutines, and parameters), and 8.1 (2-dimensional arrays).
- Bring a good calculator to the exam. Calculators may not be shared during the exam.
- Computers, cell phones, and other devices may not be used on the exam.

|
Maintained by: Br. David Carlson
Last updated: April 29, 2008
Disclaimer
|
|
|
|
|