# Backward Euler Method

This module illustrates the implicit Backward Euler method for numerically 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. In the Backward Euler method, the approximate solution is advanced at each step by extrapolating along the tangent line whose slope is given by the ODE at the as yet unknown target point. Specifically, from an approximate solution value yk at time tk for an ODE y′ = f(t, y), the Backward Euler method approximates the solution y(tk+1) at time tk+1 = tk + hk by solving the implicit equation yk+1 = yk + hk f(tk+1, yk+1) for yk+1. Since this equation may be nonlinear, solving it in general requires an iterative solution method, such as functional iteration or Newton's method.

The user begins by selecting a differential equation from the menu provided. A solution value y0 for the selected ODE at an initial time t0 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 using the Backward Euler method. Each step of the Backward Euler method is presented as a four-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 step from tk to tk+1, subject to minimum and maximum allowed values. The starting guess given by Euler's method using the currently selected step size is shown in red, and it varies as the step size varies. Once the user has set the slider for the desired step size, this choice takes effect by clicking Choose Step Size or Next, which changes from red to black the line connecting the current and next solution values, indicating that the length of the step is now fixed. The next solution value remains red because it is subject to further change due to the subsequent iterative process for solving the implicit equation.
2. The next stage is to solve the implicit equation. The user chooses either functional iteration or Newton's method and then performs one or more iterations of the selected nonlinear equation solver by clicking Iterate as many times as desired. During this stage, the exact solution to the ODE passing through the provisional next solution value is drawn in pink, and the corresponding tangent line is drawn in purple. At a solution to the implicit equation, the direction of the step taken will coincide with that of the tangent line, so progress towards convergence can be observed graphically. The residual (i.e., the difference between the right and left sides of the implicit equation) is printed numerically below as another measure of convergence. Note that the nonlinear equation methods may not always converge, especially if the step size is too large. When the user is satisfied with the convergence of the iterative solver, this stage is terminated by clicking Solve Implicit Equation or Next, which changes the color of the new solution point from red to black, indicating that it has now been fully determined, and removes the tangent line from the display.
3. The current step is concluded by clicking Take Step or Next, which prints in the table below the approximate and true solution values at the new point and changes the color of the exact solution to the ODE passing through the new solution point from pink to gray.
4. Preparation for another step is initiated by clicking Next Step or Next, which displays the new step in red, ready for selecting the new step size, with a default step size equal to the size of the previous step, if possible.

Reference: Michael T. Heath, Scientific Computing, An Introductory Survey, 2nd edition, McGraw-Hill, New York, 2002. See Section 9.3.3, especially Example 9.9.

Developers: Evan VanderZee and Michael Heath