Euler method
In mathematics and computational science, the Euler method is a first-order numerical procedure for solving ordinary differential equations (ODEs) with a given initial value. It is the most basic explicit method for numerical integration of ordinary differential equations and is the simplest Runge–Kutta method. The Euler method is named after Leonhard Euler, who treated it in his book Institutionum calculi integralis (published 1768–70).[1]
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
is known (see the picture on top right). Then, from the differential equation, the slope to the curve at
can be computed, and so, the tangent line.
Take a small step along that tangent line up to a point
Along this small step, the slope does not change too much, so
will be close to the curve. If we pretend that
is still on the curve, the same reasoning as for the point
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.[2]
[edit] Formulation of the method
Blue is the Euler method; green, the midpoint method; red, the exact solution,
The step size is h = 1.0.Suppose that we want to approximate the solution of the initial value problem
Choose a value
for the size of every step and set
. Now, one step of the Euler method from tn to tn+1 = tn + h is
The value of
is an approximation of the solution to the ODE at time
:
. The Euler method is explicit, i.e. the solution
is an explicit function of
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, by any other scheme for first-order systems.[4]
[edit] Example
Given the initial value problem
we would like to use the Euler method to approximate
using step size
.
The Euler method is
so first we must compute
. In this simple differential equation, the function
is defined by
. We have
By doing the above step, we have found the slope of the line that is tangent to the solution curve at the point
. Recall that the slope is defined as the change in
divided by the change in
, or
.
The next step is to multiply the above value by the step size
.
Since the step size is the change in
, when we multiply the step size and the slope of the tangent, we get a change in
value. This value is then added to the initial
value to obtain the next value to be used for computations.
The above steps should be repeated to find
and
.
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.
-







0 1 0 1 1 1 2 1 2 1 2 1 2 4 2 4 2 4 1 4 8
The conclusion of this computation is that
.
[edit] Derivation
The Euler method can be derived in a number of ways. Firstly, there is the geometrical description mentioned above.
Another possibility is to consider the Taylor expansion of the function
around
:
The differential equation states that
. If this is substituted in the Taylor expansion and the quadratic and higher-order terms are ignored, the Euler method arises.[5] The Taylor expansion is used below to analyze the error committed by the Euler method, and it can be extended to produce Runge–Kutta methods.
A closely related derivation is to substitute the forward finite difference formula for the derivative,
in the differential equation
. Again, this yields the Euler method.[6] A similar compution leads to the midpoint rule and the backward Euler method.
Finally, we can integrate the differential equation from
to
and apply the fundamental theorem of calculus to get:
Now approximate the integral by the left-hand rectangle method (with only one rectangle):
Combining both equations, we find again the Euler method.[7] This line of thought can be continued to arrive at various linear multistep methods.
[edit] Local truncation error
The local truncation error of the Euler method is error made in a single step. It is the difference between the numerical solution after one step,
, and the exact solution at time
. The numerical solution is given by
For the exact solution, we use the Taylor expansion mentioned in the section Derivation above:
The local truncation error (LTE) introduced by the Euler method is given by the difference between these equations:
This result is valid if
has a bounded third derivative.[8]
This shows that for small
, the local truncation error is approximately proportional to
. This makes the Euler method less accurate (for small
) than other higher-order techniques such as Runge-Kutta methods and linear multistep methods, for which the local truncation error is proportial to a higher power of the step size.
A slightly different formulation for the local trunction error can be obtained by using the Lagrange form for the remainder term in Taylor's theorem. If
has a continuous second derivative, then there exists a
such that
In the above expressions for the error, the second derivative of the unknown exact solution
can be replaced by an expression involving the right-hand side of the differential equation. Indeed, it follows from the equation
that
[edit] Global truncation error
The global truncation error is the error at a fixed time
, after however many steps the methods needs to take to reach that time from the initial time. The global truncation error is the cumulative effect of the local truncation errors committed in each step.[11] The number of steps is easily determined to be
, which is proportional to
, and the error committed in each step is proportional to
(see the previous section). Thus, it is to be expected that the global truncation error will be proportional to
.[12]
This intuitive reasoning can be made precise. If the solution
has a bounded second derivative and
is Lipschitz continuous in its second argument, then the global truncation error (GTE) satisfies the bound
where
is an upper bound on the second derivative of
on the given interval and
is the Lipschitz constant of
.[13]
The precise form of this bound of little practical importance, as in most cases the bound vastly overestimates the actual error committed by the Euler method.[14] What is important is that it shows that the global truncation error is (approximately) proportional to
. For this reason, the Euler method is said to be first order.[15]
This also suggests that, 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
) is the following:
When the step size is changed to
our
value becomes
. The error, then, for step size
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.
As the global error is proportional to
, this suggests that in the order of hundred thousand steps are needed to get an answer that is correct to three decimal places. 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, espectially if a high accuracy is desired.[16]
[edit] Numerical stability
The Euler method can also be numerically unstable, especially for stiff equations, meaning that the numerical solution grows very large for equations where the exact solution does not.
If the Euler method is applied to the linear equation
, then the numerical solution is unstable if the product
is outside the region
illustrated on the right. This region is called the (linear) instability region.[17]
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 methods for 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] Notes
- ^ Butcher 2003, p. 45; Hairer, Nørsett & Wanner 1993, p. 35
- ^ Atkinson 1989, p. 342; Butcher 2003, p. 60
- ^ Butcher 2003, p. 45; Hairer, Nørsett & Wanner 1993, p. 36
- ^ Butcher 2003, p. 3; Hairer, Nørsett & Wanner 1993, p. 2
- ^ Atkinson 1989, p. 342; Hairer, Nørsett & Wanner 1993, p. 36
- ^ Atkinson 1989, p. 342
- ^ Atkinson 1989, p. 343
- ^ Butcher 2003, p. 60
- ^ Atkinson 1989, p. 342
- ^ Stoer & Bulirsch 2002, p. 474
- ^ Atkinson 1989, p. 344
- ^ Butcher 2003, p. 49
- ^ Atkinson 1989, p. 346; Lakoba 2012, equation (1.16)
- ^ Iserles 1996, p. 7
- ^ Butcher 2003, p. 63
- ^ Hairer, Nørsett & Wanner 1993, p. 40
- ^ Butcher 2003, p. 70; Iserles 1996, p. 57
[edit] References
- Atkinson, Kendall A. (1989), An Introduction to Numerical Analysis (2nd ed.), New York: John Wiley & Sons, ISBN 978-0-471-50023-0.
- Ascher, Uri M.; Petzold, Linda R. (1998), Computer Methods for Ordinary Differential Equations and Differential-Algebraic Equations, Philadelphia: Society for Industrial and Applied Mathematics, ISBN 978-0-89871-412-8.
- Butcher, John C. (2003), Numerical Methods for Ordinary Differential Equations, New York: John Wiley & Sons, ISBN 978-0-471-96758-3.
- Hairer, Ernst; Nørsett, Syvert Paul; Wanner, Gerhard (1993), Solving ordinary differential equations I: Nonstiff problems, Berlin, New York: Springer-Verlag, ISBN 978-3-540-56670-0.
- Iserles, Arieh (1996), A First Course in the Numerical Analysis of Differential Equations, Cambridge University Press, ISBN 978-0-521-55655-2
- Stoer, Josef; Bulirsch, Roland (2002), Introduction to Numerical Analysis (3rd ed.), Berlin, New York: Springer-Verlag, ISBN 978-0-387-95452-3.
- Lakoba, Taras I. (2012), Simple Euler method and its modifications (Lecture notes for MATH334, University of Vermont), http://www.cems.uvm.edu/~lakobati/math337/notes_1.pdf, retrieved 29 February 2012.
[edit] External links
| The Wikibook Calculus has a page on the topic of |
|
|||||||||||


,



















