Scientific Computing

This module investigates the accuracy of Euler's method for numerically solving initial value problems for ordinary differential equations by estimating its local and global error. A numerical method for an ordinary differential equation (ODE) generates an approximate solution step-by-step in discrete increments across the interval of integration, in effect producing a discrete sample of approximate values of the solution function. Euler's method advances the approximate solution at each step by extrapolating along the tangent line whose slope is given by the ODE. This module shows estimates of the local error and cumulative global error for each step of Euler's method. These quantities are defined in greater detail below.

The user begins by selecting a differential equation from the menu
provided. A solution value for the selected ODE at an initial time
is marked with a black dot, and the exact solution curve for the
resulting initial value problem is drawn in black. Starting from this
initial value, the user advances the solution through successive steps
of Euler's method. Each step is presented as a three-stage process.
Each stage is executed by clicking either *Next* or the currently
highlighted stage:

- Subject to minimum and maximum allowed values, the slider can be used
to select any desired step size. The approximate solution that
would result from the currently selected step size is drawn in red.
Estimates for the resulting local error and (after the first step)
cumulative global error are shown as dark blue and light blue regions,
respectively, around the approximate solution (the dark blue region is
superimposed on the light blue region, so some of the latter is
obscured by the former). Clicking
*Choose Step Size*or*Next*causes the currently selected step size to take effect. The new portion of the approximate solution, now determined, changes color from red to black. - The current step is concluded by clicking
*Take Step*or*Next*, which draws the exact solution through the new point in pink (erasing any previous pink curve) and prints the approximate and true solution values at the new point in the table below. The local error estimate (dark blue region) is removed, but the global error estimate (light blue region) remains. - Preparation for another step is initiated by clicking
*Next Step*or*Next*, which displays the new step so that the user can choose its size. The default step size is equal to the size of the previous step, if possible.

Successive steps of Euler's method may be continued until the the interval has been fully traversed.

If an error estimate is accurate, the corresponding solution should fall within the appropriate colored region. This means that the exact solution passing through the most recent solution point should fall within the dark blue local error estimate, and the exact solution to the initial value problem should fall within the light blue global error estimate. Since the module uses error estimates rather than error bounds, this is not always the case. (True bounds are rigorous, but are often overly pessimistic.) A detailed description of the estimates used in this module follows.

For an ODE *y*′ = *f*(*t*,
*y*)*t*_{0},
*y*_{0})*y*(*t*)*t*_{k},
*y*_{k})*h*_{k} = *t*_{k} −
*t*_{k−1}.*k* is the error made by the numerical method in stepping from
time *t*_{k−1}*t*_{k}.*u*_{k−1}(*t*)*t*_{k−1},
*y*_{k−1})*y*_{k} −
*u*_{k−1}(*t*_{k})*h*_{k}^{2}⁄ 2)
*y*_{k}″.*y*_{k}″*f* (*t*_{k},
*y*_{k}) − *f*(*t*_{k−1},
*y*_{k−1})) ⁄ (*t*_{k}
− *t*_{k−1})

The global error is the total error made relative to the exact
solution to the initial value problem, given by
*y*_{k} −
*y*(*t*_{k}).*u*_{k−1}(*t*)*y*(*t*). Suppose the global error at the
beginning of step *k* is bounded by
*e*_{k−1}.*N* = | 1 + *h*_{k}*
f_{y}(t_{k−1},
y_{k−1}) |,*

**Reference:**
Michael T. Heath, *Scientific Computing,
An Introductory Survey*, 2nd edition, McGraw-Hill, New York,
2002. See Section 9.3.2.

**Developers:** Evan VanderZee and Michael Heath