Computational & Experimental Physics

the Euler method

/ OY-ler /

Picture standing on a hillside in thick fog with only a compass that tells you the slope of the ground right where you stand. You cannot see the whole path, but you can take one small step in the direction the ground currently tilts, look again, and step again. The Euler method solves a differential equation exactly this way: when you know the rate of change at your present state, you take a small step in that direction and repeat. It answers the practical question of how to follow an equation of motion forward in time when no pencil-and-paper solution exists.

For a first-order equation dx/dt = f(x, t) with an initial value x(t_0) = x_0, choose a small time step h and advance by x(t + h) = x(t) + h f(x(t), t), then iterate t -> t + h. This is nothing but the first two terms of a Taylor expansion, x(t+h) = x(t) + h x'(t) + (h^2/2) x''(t) + ..., with everything past the linear term thrown away. Discarding the h^2 term makes the local (one-step) error of order h^2, and because errors accumulate over roughly 1/h steps to cross a fixed interval, the global error is of order h. Euler is therefore a first-order method: halving h only halves the total error.

You meet the Euler method first because it is the simplest possible integrator and the conceptual seed of every fancier one. But it is rarely good enough for real work: it is only first-order accurate, it can be numerically unstable if h is too large, and for oscillatory or Hamiltonian systems it does not conserve energy, so an orbit spuriously spirals outward step after step. In practice it is a teaching baseline; production code uses higher-order Runge-Kutta schemes or, for conservative systems, symplectic integrators like Verlet.

Integrating a simple harmonic oscillator (a mass on a spring) with forward Euler and a finite step h, the computed total energy grows a little every cycle, so the plotted trajectory spirals outward instead of tracing a closed ellipse in phase space.

The classic failure mode: forward Euler injects spurious energy into an oscillator.

Forward Euler is only first-order accurate, so halving the step size merely halves the global error rather than quartering it; and being non-symplectic it does not conserve energy, which is why it is a teaching tool rather than a production integrator.

Also called
forward Euler methodexplicit Euler method顯式尤拉法歐拉法