Introduction
Some integrals and differential equations cannot be solved exactly. This optional Further Maths topic gives better numerical integration than the trapezium rule (the mid-ordinate rule and Simpson's rule) and step-by-step methods for differential equations (Euler's method and its improvement).
Why it matters
has no elementary antiderivative, yet engineers need its value. Weather forecasts and spacecraft trajectories come from solving differential equations step by step on computers, using refined versions of exactly these methods.
Intuitive explanation
The trapezium rule joins points with straight lines. Simpson's rule fits a parabola through each set of three consecutive points, so it follows curves much more closely and is far more accurate for the same number of strips.
A differential equation tells you the slope at every point. Start at a known point, walk a short distance along the slope, recompute the slope, and repeat. Small steps keep you close to the true curve.
Formal definitions
, using the heights at the midpoints of the strips.
For : , .
.
Notation
- is the step or strip width.
- .
Comparison
| Method | Error behaviour |
|---|---|
| Trapezium | error roughly |
| Mid-ordinate | error roughly , often half the trapezium error |
| Simpson | error roughly |
| Euler | global error roughly |
Key results
Simpson's rule gives the exact integral for any polynomial of degree at most 3.
Why Euler works
Near , (the tangent line). The equation gives . Each step uses the tangent at the current point.
Shift the two strips to and fit through , , . Then and . Integrating,
The term integrates to zero, so was never needed. Adding up the pairs of strips gives the composite rule with weights .
∎Let be the true solution of , the error, and suppose and . Taylor's theorem gives with (the local truncation error). Subtracting the Euler step and using the mean value theorem on :
With this gives , using . So the global error is at most a constant times : local errors of size , accumulated over steps and amplified by at most . Q53 shows the bound has the right order: for the error really is about .
∎Expand everything in powers of , writing , , for values at . The exact solution satisfies , since . The method gives
which agrees up to the term. So the local error is and the global error : halving quarters the error (Q47).
∎Methods
Lay out , and in a table, keeping at least 5 significant figures throughout.
Examples
, , : .
See the Worked examples tab.
Common mistakes
Simpson's rule needs an even number of strips.
Odd-numbered ordinates get weight 4, even-numbered interior ones weight 2.
Applications
- Scientific computing: all ODE solvers refine Euler's idea.
- Statistics: areas under the normal curve.
Connections
- Numerical methods (A level): trapezium rule, iteration.
- Differential equations.
Summary
- Mid-ordinate: . Simpson: , even.
- Euler: . Smaller , better accuracy.
Worked examples
Try each one yourself first, then open the solution.
Use Simpson's rule with 4 strips to estimate , and compare with the exact value.
Show the solution
- 1Ordinates
: .
- 2Apply
.
- 3Compare
Exact : error about .
, . Use Euler's method with to estimate .
Show the solution
- 1Step 1
.
- 2Step 2
.
- 3Step 3
.
(exact )
University-level ideas and the deeper mathematics behind this topic. Not needed for exams, but this is where the subject really opens up.
Designing Runge–Kutta methods (university)
The improved Euler method samples the slope twice; RK4 (Q51) samples it four times. Where do such formulas come from?
The general form. An -stage explicit Runge–Kutta method computes
and is recorded in a Butcher tableau of the numbers , , . Improved Euler has , , ; the midpoint method has , .
Order conditions. Expanding in powers of as in the proof above and matching with the Taylor series of the true solution gives equations for the coefficients. For order :
| order | conditions (with ) |
|---|---|
| 1 | |
| 2 | |
| 3 | , |
| 4 | four more, e.g. |
For with two stages there is a one-parameter family (improved Euler and the midpoint method are two members). John Butcher showed that the conditions correspond to rooted trees, one for each way the derivatives of can be nested: new conditions at orders . There are conditions for order , which four stages can just satisfy; order needs conditions and at least six stages. These "Butcher barriers" explain why RK4 is so popular: it is the highest order you can get for the number of stages.
Simpson in disguise. If depends only on , the ODE is just an integral, and RK4 becomes : Simpson's rule. Similarly improved Euler becomes the trapezium rule and the midpoint method the mid-ordinate rule. Every quadrature rule you have met is a Runge–Kutta method for the simplest ODE.
Adaptive step size. Practical solvers (such as ode45 in MATLAB or solve_ivp in Python) use embedded pairs: two methods of orders and sharing the same . Their difference estimates the local error, and the step is shrunk where the solution changes fast and enlarged where it is smooth. This is the answer to Q49: near the blow-up of an adaptive solver automatically takes tiny steps.
Stability, stiffness and the complex plane (university)
Q36, 54, 55 and 60 showed methods failing not from inaccuracy but from instability. The standard way to study this is to apply a method to the test equation with complex (complex covers oscillations as well as decay, since systems decouple into such equations along eigenvectors).
The amplification factor. A one-step method gives with . Its region of absolute stability is :
- Euler: , the disc of radius centred at .
- Improved Euler: , a slightly larger oval region meeting the real axis at (Q54).
- RK4: , reaching about on the real axis and on the imaginary axis.
- Backward Euler: , stable outside the disc of radius centred at : the whole left half-plane and more (Q55).
- Trapezium rule (implicit): , stable exactly on the left half-plane.
A-stability. A method is A-stable if its region contains the whole left half-plane : every decaying solution is computed as decaying, whatever the step size. No explicit Runge–Kutta method can be A-stable, because its is a polynomial, and polynomials are unbounded. Implicit methods have rational and can be.
Stiffness. A system is stiff when it has some very fast-decaying components alongside the slow ones you care about. In a chemical reaction one species may settle in microseconds while the interesting chemistry takes hours. An explicit method must keep inside its small stability region for the fastest , forcing microsecond steps for hours of simulated time. An A-stable implicit method can step at the pace of the slow components. The price is solving an equation (usually by Newton's method) every step.
Dahlquist's barriers. For multistep methods like the formula of Q60 (which use several previous values), Germund Dahlquist proved two famous limits (1956, 1963):
- A stable -step method has order at most about ; the extra roots of its characteristic equation (like in Q60) must not grow.
- An A-stable multistep method has order at most , and the trapezium rule is the most accurate one.
Convergence = consistency + stability. Dahlquist's equivalence theorem (the ODE counterpart of the Lax equivalence theorem for PDEs) says a multistep method converges as exactly when it is consistent (it has order at least ) and zero-stable (no root of its characteristic polynomial at has size above , and roots of size exactly are simple). Accuracy alone is never enough.
Geometric integration: keeping planets in orbit (university)
Simulate a planet, a pendulum or a molecule for a long time and a new issue appears: the method may be accurate over a few steps, yet slowly violate a law the true motion obeys exactly, such as conservation of energy.
Euler spirals outward. For the harmonic oscillator , , the energy is constant. Euler's method gives , , so
The energy grows by a factor every step, about over a time : the simulated orbit spirals outwards for ever, however small is. Backward Euler spirals inwards. Neither is acceptable for a simulation of the solar system over millions of years.
Symplectic Euler. Change one letter: update with the new ,
Now the quantity is exactly the same at every step (check by substituting). This "modified energy" differs from by , so the true energy oscillates slightly but never drifts. The orbit stays closed.
Why it works. Hamiltonian systems (frictionless mechanics) have flows that preserve area in phase space (Liouville's theorem), or more precisely a structure called the symplectic form. Euler's map has determinant , so it expands areas; the symplectic Euler map has determinant exactly . A deep result of backward error analysis says that a symplectic method applied to a Hamiltonian system is, up to exponentially small errors, the exact solution of a slightly different Hamiltonian system. So it inherits conserved quantities, stable orbits and long-time behaviour that non-symplectic methods destroy.
Verlet. The central difference scheme of Q57,
is equivalent to a symmetric version of symplectic Euler (Störmer–Verlet, or leapfrog). It is second order, symplectic and time-reversible, needs one force evaluation per step, and is the workhorse of molecular dynamics, where simulations run for billions of steps. Its two-step form looks like Q60's unstable formula, but for oscillations both characteristic roots lie on the unit circle, which is exactly the situation where such methods behave well.
Beyond. The same philosophy (design methods that respect the structure of the problem: conservation laws, symmetries, positivity, constraints) runs through modern numerical analysis, from Lie group integrators for spinning rigid bodies to structure-preserving schemes for fluid flow and general relativity.
Why does this work?
It integrates a parabola through each three points exactly. By symmetry it also integrates cubics exactly (the cubic error term is odd about the midpoint and cancels). So its error comes from the fourth derivative, and halving the strip width divides the error by about 16.
Beyond the syllabus
Mathematical curiosities
Some equations, such as , force explicit methods to take absurdly small steps to stay stable, even though the solution itself is smooth. Implicit methods (which solve an equation at each step) overcome this, and are used in chemistry and circuit simulation.