Lably
Skip to content

Euler method

Approach to finding numerical solutions of ordinary differential equations

  • 10 min read
  • 10 chapters

Related on Lably

Through Mathematics, Numerical analysis and Ordinary differential equation

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,y0′,…,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+1yi+1′⋮yi+1(N−1)yi+1(N))=(yi+h⋅yi′yi′+h⋅yi″⋮yi(N−1)+h⋅yi(N)yi(N)+h⋅f(ti,yi,yi′,…,yi(N)))

These first-order systems can be handled by Euler's method or, in fact, by any other scheme for first-order systems.

Sign in to keep reading

9 more chapters are free with a Lably account.

More in Calculus and analysis