Euler method
In mathematics and computational science, the Euler method, named after Leonhard Euler, is a first-order numerical procedure for solving ordinary differential equations (ODEs) with a given initial value. It is the most basic kind of explicit method for numerical integration of ordinary differential equations and is the simplest kind of Runge-Kutta method.
Contents |
[edit] Informal geometrical description
Consider the problem of calculating the shape of an unknown curve which starts at a given point and satisfies a given differential equation. Here, a differential equation can be thought of as a formula by which the slope of the tangent line to the curve can be computed at any point on the curve, once the position of that point has been calculated.
The idea is that while the curve is initially unknown, its starting point, which we denote by A0, is known (see the picture on top right). Then, from the differential equation, the slope to the curve at A0 can be computed, and so, the tangent line.
Take a small step along that tangent line up to a point A1. If we pretend that A1 is still on the curve, the same reasoning as for the point A0 above can be used. After several steps, a polygonal curve
is computed. In general, this curve does not diverge too far from the original unknown curve, and the error between the two curves can be made small if the step size is small enough and the interval of computation is finite (although things are more complicated for stiff equations, as discussed below).
[edit] Derivation
We want to approximate the solution of the initial value problem
by using the first two terms of the Taylor expansion of y, which represents the linear approximation around the point (t0,y(t0)) . One step of the Euler method from tn to tn+1 = tn + h is
The Euler method is explicit, i.e. the solution yn + 1 is an explicit function of yi for
.
While the Euler method integrates a first order ODE, any ODE of order N can be represented as a first-order ODE: to treat the equation
,
we introduce auxiliary variables
and obtain the equivalent equation
This is a first-order system in the variable
and can be handled by Euler's method or, in fact, any other scheme for first-order systems.
[edit] Example
Given the differential equation y' = y and the initial point y(0) = 1, we would like to use the Euler method to approximate y3 using step size h = 1.
The Euler method is
so first we must compute f(t0,y0). This simple differential equation depends only on y, so we need only worry about inputting the values for y.
By doing the above step, we have found the slope of the line that is tangent to the solution curve at the point (0,1). Recall that the slope is defined as the change in y divided by the change in t, or
.
The next step is to multiply the above value by the step size h.
Since the step size is the change in t, when we multiply the step size and the slope of the tangent, we get a change in y value. This value is then added to the initial y value to obtain the next value to be used for computations.
The above steps should be repeated to find y2 and y3.
Due to the repetitive nature of this algorithm, it can be helpful to organize computations in a chart form, as seen below, to avoid making errors.
| yn | tn | y'(t) | h | dy | yn + 1 |
|---|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 1 | 2 |
| 2 | 1 | 2 | 1 | 2 | 4 |
| 4 | 2 | 4 | 1 | 4 | 8 |
[edit] Error
The magnitude of the errors arising from the Euler method can be demonstrated by comparison with a Taylor expansion of y. If we assume that f(t) and y(t) are known exactly at a time t0, then the Euler method gives the approximate solution at time t0 + h as:
In comparison, the Taylor expansion in h about t0 gives:
Since we know that y' = f(t,y) it follows that
This, along with f(t0,y(t0)) can be inserted into the Taylor expansion in h about t0.
The error introduced by the Euler method is given by the difference between these equations:
For small h, the dominant error per step, or the local truncation error, is proportional to h2. To solve the problem over a given range of t, the number of steps needed is proportional to 1 / h so it is to be expected that the total error at the end of the fixed time, or the global truncation error, will be proportional to h (error per step times number of steps). Because the global truncation error is proportional to h, the Euler method is said to be first order. This makes the Euler method less accurate (for small h) than other higher-order techniques such as Runge-Kutta methods and linear multistep methods.
As stated in the introduction, decreasing the step size can help to make the approximation more accurate and decrease the error between the two curves. The error to three decimal places for the example in the above section (with step size h = 1)is the following:
When the step size is changed to h = 0.1 our y3 value becomes 17.449. The error, then, for step size h = 0.1 is the following:
Although the error has decreased, our approximation is still not particularly accurate. In addition, since the step size decreased with no change in the interval, the number of iterations has increased to thirty. While possible, it is no longer reasonable to do these computations by hand.
[edit] Error bound
As with other methods, there is a way for us to determine an error bound for a particular problem. The error bound on the global error is given by[1]:
where h is the step size, M is the upper bound on the second derivative of y on the given interval (which must be estimated), and L is the Lipschitz constant.
If the error bound is computed, it can be seen, once again, that if small error is desired, the step size h must be very small.
For instance, let us calculate the step size required for global truncation error to be
, assuming a maximum value for the second derivative of M = 10, a Lipschitz constant of L = 1, and t from zero to four. Using the equation given, we obtain the following:
which means that h must be smaller than the above to get the desired error or less, and 4/h, or about 1072 iterations will need to be completed to do so. The large number of steps, and thus high computation cost, supports the use of alternative, higher-order methods such as Runge–Kutta methods or linear multistep methods.
[edit] Numerical stability
The Euler method can also be numerically unstable, especially for stiff equations. This limitation—along with its slow convergence of error with h—means that the Euler method is not often used, except as a simple example of numerical integration. The instability can be avoided by using the Euler–Cromer algorithm.
[edit] See also
- Numerical integration of ordinary differential equations
- For numerical methods for calculating definite integrals, see Numerical integration
- Gradient descent similarly uses finite steps, here to find minima of functions
- Dynamic errors of numerical methods of ODE discretization
[edit] References
- Ascher, Uri M.; Petzold, Linda Ruth. Computer methods for ordinary differential equations and differential-algebraic equations. 1998. SIAM. ISBN 0898714125
[edit] External links
| The Wikibook Calculus has a page on the topic of |
|
|||||||||||


,








![y(t_0 + h) = y(t_0) + h f(t_0, y(t_0)) + \frac{1}{2}h^2[{\partial f\over\partial t}(t_0, y(t_0)) + {\partial f\over\partial y}(t_0, y(t_0)) f(t_0, y(t_0))] + O(h^3).](http://upload.wikimedia.org/wikipedia/en/math/f/a/1/fa1b40028862483e80dc977bba278591.png)
![\frac{1}{2}h^2 [{\partial f\over\partial t}(t_0, y(t_0)) + {\partial f\over\partial y}(t_0, y(t_0)) f(t_0, y(t_0))] + O(h^3).](http://upload.wikimedia.org/wikipedia/en/math/f/8/f/f8fe9d9c702b709788d33d08e2e74d1d.png)





