A differential equation tells you the slope of the solution at every point, but most such equations have no solution formula. You can still follow the slopes. Stand at the starting point, walk a short way in the direction the equation points, look at the new slope, and walk again. That is Euler’s method, and every method here is a smarter way of choosing the direction for each step.
Key terms
Euler polygon
Definition Consider the initial value problem , . Choose a step size and set . Euler’s method computes
The Euler polygon is the broken line joining the points . Each segment has the slope that the equation assigns to its left endpoint.
In plain words Follow the tangent line for a distance , then recompute the slope where you landed and follow the new tangent.
Example Take , , with . Two steps give
The exact solution is , with and . The polygon runs below the curve because the solutions are concave up here, so each tangent segment undershoots.
Improved Euler method
Definition The improved Euler method first predicts with an Euler step and then averages the slopes at both ends of the step.
It is the trapezoidal rule applied to
with the unknown endpoint value replaced by the Euler prediction.
In plain words Take a trial step, look at the slope where it lands, and then redo the step using the average of the old and new slopes.
Example For , and , one step gives , a trial value , , and
The error at is about , compared with for Euler’s method.
The Runge-Kutta idea
Definition A Runge-Kutta method computes several slopes at trial points inside the step, each built from the previous ones, and advances with a weighted average of them. The weights are chosen so that the step agrees with the Taylor expansion of the true solution through as high a power of as possible. The classical fourth order method is
When depends only on , this step is exactly Simpson’s rule on with the midpoint .
In plain words Sample the slope at the start, twice in the middle and at the end, and average them with the middle counting double.
Example For , and , the four slopes are
so
The exact value is , so a single large step is already off by only .
Local and global error
Definition The local truncation error of a one-step method at step is the error made in that one step when it starts from the exact value, that is minus the result of the method’s step applied to . The global error at is , the accumulated difference after all steps. A method has order if its local error is , and then for a smooth problem its global error on a fixed bounded interval is . Euler’s method has order , improved Euler order and classical Runge-Kutta order .
For Euler’s method there is an explicit bound. Suppose is continuous for and all real , and satisfies the Lipschitz condition
there for all and , with a constant . Suppose also that the exact solution exists on , is twice differentiable there, and has on . If the arithmetic is exact and the method starts from the exact value , then for every
In plain words Each step adds a small new error, and the old errors are carried along. About steps of size add up to an error of size .
Example For , on we have and . With the bound is
Euler’s method gives , and the actual global error is within it.
Step-size refinement
Definition Step-size refinement means repeating a computation with replaced by and comparing. Write for the result at a fixed point computed with step . For a method of order the global error at is about for small , with independent of , so halving divides the error by about , and the error of the finer result is estimated by
In plain words Halve the step and see how much the answer moves. The size of the change tells you roughly how wrong the finer answer still is.
Example For , , here are the errors at .
| Euler | Improved Euler | Runge-Kutta | |
|---|---|---|---|
Each halving divides the errors by about , and . For Euler, and differ by . With that difference is the estimate for the error of , and it is close, since the actual error is .
Stability
Definition Apply a method to the test equation with , whose solutions all decay to . The method is absolutely stable for a step if its numerical solution also tends to for every starting value. Euler’s method gives , so , and it is absolutely stable exactly when
Every explicit Runge-Kutta method has some such limit. On the test equation its step multiplies by a polynomial in that is not constant, and a nonconstant polynomial grows without bound in absolute value as , so a large enough step always makes the numbers grow.
In plain words If the step is too large for how quickly the true solution changes, the numbers overshoot, flip sign and blow up even though the true solution quietly goes to zero.
Example For , the limit is . With the factor is , giving at , while the true value at is . With the factor is , and the values at decay as they should.
Numerical versus exact solution
Definition An exact solution is a differentiable function that satisfies and the initial condition on an interval containing . A numerical solution is a finite list of values at the grid points , which depends on the method and on and approximates only where the exact solution exists and the method converges. Between grid points it gives no values unless you interpolate.
In plain words The computer always returns numbers, even when they mean nothing. Theory tells you whether a solution exists and where.
Example The problem , has the exact solution
which blows up at and does not exist past it. Euler’s method with happily gives , , , and at . The last two numbers approximate nothing, and nothing in the list itself warns you.
Check yourself
- Do two Euler steps with for , , and compare with the exact value at .
Show the answer
The two steps give
The exact solution is , and , so the error is about .
- A second order method has a global error of at some point with step . About what error do you expect with step ?
Show the answer
Order means halving divides the error by about , so about .
- For which step sizes is Euler’s method absolutely stable on ?
Show the answer
You need , so .