Go to CCP Homepage Go to Materials Page Go to Differential Equations Materials Go to Table of Contents
Go Back One Page Go Forward One Page

Numerical Solutions of Differential Equations

Part 1: Background: Euler's Method

The problem we address in this module is that of finding the solution of any initial value problem of the form

dy/dt = f(t,y) with y(0) = y0.

This means that our given information is essentially a direction field together with a starting point in that field, as in the following figure, which shows the problem

dy/dt = 2y (2 - y) with y(0) = 0.4.

We will calculate approximate values for the velocity y at n equally spaced points in some fixed time interval. Specifically, our goal is to estimate the velocity y(t) at times

t0 = 0, t1 =t, t2 = 2 t, ... , tn = n t.

Our estimated values of y at these times will be denoted by

y0, y1, y2, y3, ... , yn.

Our method for estimating the y-values will be recursive, i.e., yk will be calculated from the preceding yk-1 for each k = 1, 2, 3, ... .

How do we obtain y1 from y0, the initial velocity? We answer this geometrically, using the graph of y versus t in the (t,y)-plane. The next figure ...

...shows a graph of the starting situation: the initial value of y is shown as a vertical line segment of length y0 at the starting time t0 = 0. We now add ...

... the graph of y versus t. Our next value, y(t1), is shown as the length of a vertical line segment at time t1. However, this value is not known to us, so we estimate its value by...

...drawing the tangent line to the graph at t = t0. Follow this tangent line to the point P, the top of a vertical line segment that approximates y(t1). Moreover, we can compute the length of this new line segment: We separate the line segment into two pieces -- the bottom piece having length y0 and the top piece being the rise of a right triangle with run = t. Using

slope = rise / run,

we see that rise equals slope times t. Hence, y(t1) is approximated by y0 + slope x t, so we can write

y1 = y0 + slope x t.

This is the key to Euler's Method for approximating the solution of an initial value problem. It's a useful formula because the slope (of the tangent line) equals the derivative dy/dt, which we know from our original differential equation when t = t0 and y = y0.

For the example

dy/dt = 2y (2 - y) with y(0) = 0.4,

we have

slope = dy/dt = 2y0 (2 - y0) = 1.28.

Substituting this value of the slope into the formula for y1, we find

y1 = y0 + 2y0 (2 - y0) x t.

Great! This gives us a method for going from y0 to y1. But how do we go from y1 to y2? Easy -- we use the same equation, only with y0 and y1 replaced by y1 and y2:

y2 = y1 + 2y1(2 - y1) x t.

In general, to go from yk-1 to yk we have

yk = yk-1 + 2yk-1 (2 - yk-1) x t.

This equation, along with the initial value y0 = 0.4 and the assignment of a value to the step size t, gives us what we need to generate successive y-coordinates to go with our equally spaced t-coordinates.

For the general first-order initial value problem,

dy/dt = f(t,y) with y(0) = y0,

Euler's Method takes the form

yk = yk-1 + f(tk-1, yk-1) x t.

For this formula to work well, the step size t has to be small enough that the corresponding segment of the unknown curve is "pretty straight." In the next part of the module, we will explore Euler's Method and some of its extensions that are available in your helper application.

The idea behind the extensions is the same: Calculate each rise as an estimated slope times a run (or step size), where the run is under the control of the user. What distinguishes the different methods is the sophistication of the slope estimate. In the Improved Euler Method (also called the Heun Method), the Euler estimate of the next point is fed back into the derivative formula, f(t,y), to get an estimate of the slope at the right-hand end of the interval. Then the two slopes for that interval are averaged. For the Runge-Kutta Method, additional slope estimates are made at the midpoint of the interval, and a slope is calculated as a weighted average of all the estimates -- with the midpoint estimates getting more weight than the endpoint estimates.

Go to CCP Homepage Go to Materials Page Go to Differential Equations Materials Go to Table of Contents
Go Back One Page Go Forward One Page


modules at math.duke.edu Copyright CCP and the author(s), 1998-2000