In mathematics and computational science, the Euler method (also called the forward 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 first proposed it in his book Institutionum calculi integralis (published 1768–1770). The Euler method is a first-order method, which means that the error (error per step) is proportional to the square of the step size, and the global error (error at a given time) is proportional to the step size. The Euler method often serves as the basis to construct more complex methods, e.g., predictor–corrector method.
Geometrical description
Purpose and why it works 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 Figure 1). 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. Along this small step, the slope does not change too much, so A1 will be close to the curve. 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 (A0,A1,A2,A3,…) 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.
First-order process When given the values for t0 and y(t0), and the derivative of y is a given function of t and y denoted as y′(t)=f(t,y(t)). Begin the process by setting y0=y(t0). Next, choose a value h for the size of every step along t-axis, and set tn=t0+nh (or equivalently tn+1=tn+h). Now, the Euler method is used to find yn+1 from yn and tn: yn+1=yn+hf(tn,yn). The value of yn is an approximation of the solution at time tn, i.e., yn≈y(tn). The Euler method is explicit, i.e. the solution yn+1 is an explicit function of yi for i≤n.
Higher-order process While the Euler method integrates a first-order ODE, any ODE of order N can be represented as a system of first-order ODEs. When given the ODE of order N defined as y(N+1)(t)=f(t,y(t),y′(t),…,y(N)(t)), as well as h, t0, and y0,y'0,…,y0(N), we implement the following formula until we reach the approximation of the solution to the ODE at the desired time: y→i+1=(yi+1y'i+1⋮yi+1(N−1)yi+1(N))=(yi+h⋅y'iy'i+h⋅y′'i⋮yi(N−1)+h⋅yi(N)yi(N)+h⋅f(ti,yi,y'i,…,yi(N))) These first-order systems can be handled by Euler's method or, in fact, by any other scheme for first-order systems.
First-order example Given the initial value problem y′=y,y(0)=1, we would like to use the Euler method to approximate y(4).
Using step size equal to 1 (h = 1)
The Euler method is yn+1=yn+hf(tn,yn). so first we must compute f(t0,y0). In this simple differential equation, the function f is defined by f(t,y)=y. We have f(t0,y0)=f(0,1)=1. 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 ΔyΔt. The next step is to multiply the above value by the step size h, which we take equal to one here: h⋅f(y0)=1⋅1=1. 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. y0+hf(y0)=y1=1+1⋅1=2. The above steps should be repeated to find y2, y3 and y4. y2=y1+hf(y1)=2+1⋅2=4,y3=y2+hf(y2)=4+1⋅4=8,y4=y3+hf(y3)=8+1⋅8=16. 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.
The conclusion of this computation is that y4=16. The exact solution of the differential equation is y(t)=et, so y(4)=e4≈54.598. Although the approximation of the Euler method was not very precise in this specific case, particularly due to a large value step size h, its behaviour is qualitatively correct as the figure shows.
Using other step sizes
As suggested in the introduction, the Euler method is more accurate if the step size h is smaller. The table below shows the result with different step sizes. The top row corresponds to the example in the previous section, and the second row is illustrated in the figure.
The error recorded in the last column of the table is the difference between the exact solution at t=4 and the Euler approximation. In the bottom of the table, the step size is half the step size in the previous row, and the error is also approximately half the error in the previous row. This suggests that the error is roughly proportional to the step size, at least for fairly small values of the step size. This is true in general, also for other equations; see the section Global truncation error for more details. Other methods, such as the midpoint method also illustrated in the figures, behave more favourably: the global error of the midpoint method is roughly proportional to the square of the step size. For this reason, the Euler method is said to be a first-order method, while the midpoint method is second order. We can extrapolate from the above table that the step size needed to get an answer that is correct to three decimal places is approximately 0.00001, meaning that we need 400,000 steps. This large number of steps entails a high computational cost. For this reason, higher-order methods are employed such as Runge–Kutta methods or linear multistep methods, especially if a high accuracy is desired.
… excerpt ends here. Continue reading the full article.





