Numerical Solution of Ordinary Differential Equations [ My home page | UBC Math dept ]

Numerical Solution of Ordinary Differential Equations


Derivation

The first two labs concern elementary numerical methods for finding approximate solutions to ordinary differential equations. We start by looking at three "fixed step size" methods known as Euler's method, the improved Euler method and the Runge-Kutta method. These methods are derived (well, motivated) in the notes

Simple ODE Solvers - Derivation. (pdf file)

A summary of the three methods is given in

Simple ODE Solvers - Summary. (postscript file)

If you are having trouble understanding the mechanics of executing these algorithms look at

Euler's method. This demo contains an annotated implementation of Euler's method. You can run Euler's method one step at a time. Each step is accompanied by a commentary which shows you the computation done during that step.

A spread sheet implementation of Euler's method (postscript file) One good way to be sure you understand the mechanics of, for example, Euler's method is to implement it on a spread sheet. These notes give an example of such an implementation.

Error Behaviour

Once you understand how these algorithms are executed, you should start trying to figure out how well they work. You can experiment yourself using the lab demo below. The results of some numerical experiments are presented and discussed in the first set of notes below. The other two sets of notes explore further the error behaviour of our algorithms.

Simple ODE solvers. This demo contains a sample implementation of all three methods. You can simultaneously display the results of all three methods with various step sizes to get some first impressions as to how well the methods work.

Simple ODE Solvers - Error Behaviour. (postscript file) These notes give the results of some numerical experiments designed to determine how the error generated by Euler's method, the improved Euler method and the Runge-Kutta method depend on the step size used.

Error Behaviour - A Trivial Example. (postscript file) The initial value problem y'=y, y(0)=1 is so simple that we can easily determine both the exact solution and the approximate solution generated by Euler and his friends. So we can also determine the error generated.

Roundoff error. (postscript file) These notes give the results of a numerical experiment exploring the effect of roundoff error on Euler's method.

Variable Step Size Methods

All of the above material involves fixed step size implementations of various algorithms. That is, you have to decide what step size to use. It is possible to have the algorithm itself select, for each step, the step size that it thinks will most efficiently give a specified accuracy. These variable step size methods are described in the two sets of notes below and an annotated implementation of a simple minded variable step size is provided in the lab demo below.

Richardson Extrapolation. (postscript file) Automatic step size adjustment for many different algorithms is based on an idea called Richardson extrapolation, that is described in these notes.

Variable Step Size Methods. (pdf file) These notes show how Richardson extrapolation can be used to develop algorithms for generating numerical solutions to ODEs that automatically select the step size used in each step.

A Simple ODE Solver with Automatic Step Size Adjustment. This demo contains an annotated implementation of a very naive variable step size method. You can run it one step at a time. Each step is accompanied by a commentary which shows you the computation done during that step.

Systems

How First Order Systems Arise. (postscript file) These notes discuss the basic mechanisms whereby systems of first order ode's arise. One of these mechanisms is a simple trick that can be used to convert any higher order ode into a first order system. It is easy to use this trick to adapt the above algorithms to handle higher order equations.


[ My home page | UBC Math dept ]