Interactive Educational Modules in
Scientific Computing


This module explores the stability of Euler's method for solving initial value problems for ordinary differential equations. 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. Such a numerical method is said to be stable if small perturbations do not cause the resulting numerical solutions to diverge without bound. This module applies Euler's method to solve two-dimensional homogeneous linear systems of ODEs with constant coefficients. Such a system has the form y ′ = A y, and Euler's method with step size hk is stable when all the eigenvalues of hk A lie within a circle in the complex plane of radius 1 centered at  −1.

The user begins by clicking Random to generate a random coefficient matrix and initial value. The generated coefficient matrix A is printed below, and the two components of the initial value are marked on the graph by red and blue dots. The components of the exact solution to the initial value problem are drawn on the graph with colors corresponding to those of the components of the initial value. Starting from the initial value, the user advances the numerical solution through successive steps using Euler's method. Each step of Euler's method is presented as a three-stage process. Each stage is executed by clicking either Next or the currently highlighted stage:

  1. Using the slider, the user can select any desired size hk for the current step of Euler's method, subject to minimum and maximum allowed values. The provisional numerical solution that would result from the selected step size is shown in the graph, one component in gold and the other in dark cyan. The small graph at the upper right shows the stability region for Euler's method as a green disc in the complex plane. The eigenvalues of hk A for the selected step size are marked on the graph with dots, white for eigenvalues that fall within the stability region, black otherwise. For large step sizes, the eigenvalues may fall outside the displayed region of the complex plane, and thus not appear on the graph. Clicking Choose Step Size or Next fixes the selected step size and changes the colors of the newly determined portions of the numerical solution, each component matching the color of the exact solution component it approximates.
  2. The current step is concluded by clicking Take Step or Next. The exact solution to the ODE passing through the new approximate solution point is drawn on the graph, each component in a lighter shade of the color of the corresponding exact solution component.
  3. Preparation for another step is initiated by clicking Next Step or Next, which displays the provisional numerical solution for the next step, ready for selecting the new step size. The default step size is equal to the size of the previous step, if possible.

Successive steps can be continued until the the interval has been fully traversed. The user can click Reset to start over with the current initial value problem or Random to generate a new initial value problem.

The randomly generated constant coefficient matrix is not random in the sense of randomly generated entries. Rather, the module strives to construct a matrix A with entries between −10 and 10 such that the eigenvalues of hk A fall inside the stability region for sufficiently small step sizes but outside it for permitted large step sizes.

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