**LECTURE 25**

**Ordinary Differential Equations
**

**Introduction
**

- First order, ordinary differential equations with initial conditions (initial value problems)

- Given a function y' = dy/dx = f(x,y), with y(0) = y0

- Want y(x) for some x* > 0
- More precisely, if the solution up to a point (xi,yi) is known, want to take a step of size h to estimate yi+1 = y(xi+1) where xi+1 = xi + h.

**The Euler Method
**

Given y'= f(x,y)

Approximate y' at point (xi , yi) by the slope of the line joining it and (xi+1 , yi+1);

y'(xi , yi) (yi+1 - yi) / (xi+1 - xi) = (yi+1 - yi) / h

Then conclude
f(xi , yi) (yi+1 - yi) / h , and yi+1 yi + h f(xi , yi)

- Analysis shows error in estimate h (very inaccurate 1st order method)
- Stability of the approximate solution is questionable - whether error in estimation introduces an additional parasitic solution to the differential equation that overwhelms the true solution.
- Roundoff error is also a problem.

**Euler algorithm
**

Starting from the point (0 , yo), we estimate the solution to y' = f(x,y) at x-values seperated by the step size h, until we reach the desired value xf of x. It is assumed that xf = n h for some positive integer n, which is the number of steps taken in attaining the final solution.

- x 0 , y y0
- if(x==xf) , STOP
- y = y + h* f(x,y)
- x = x + h
- go to step 2

**The Runge-Kutta method
**

- This is a whole class of formulae of which one interests us.
- The fourth order method has error h4, making it very much better than the Euler method.

Advantages (relative to more complicated techniques):

- Easy to program
- Good stability
- Easy to change step size
- Self starting (only one initial point is required)
- Reasonably accurate

The derivation of the formula is too complex,
but basic idea is to start from (xi , yi) and use Euler method
to obtain different estimates of yi + ½ and yi+1 which are
combined so as to minimize error:

y*i + ½ = yi + h/2 f(xi , yi)

y**i + ½ = yi + h/2 f(xi + ½ , y*i + ½)

y*i + 1 = yi + h f(xi + ½ , y**i + ½)

yi + 1 = yi + h/6 [ f(xi , yi) + 2f(xi + ½ , y*i + ½)

+2f(xi + ½ , y**i + ½) + f(xi + 1
, y*i + 1) ]

To use the Runge-Kutta method, start with y(0) = y0, and apply the above equations (in sequence!) to get y1 = y(h).

Repeat this process for x2, … , xn where
xn = nh.

Go back to lecture menu

Go back to main page