Maths › Further Pure 1 › Numerical methods for differential equations
Numerical methods for differential equations
Replace derivatives by differences and a differential equation becomes arithmetic: step along the solution one h at a time, and Simpson's rule measures the area you pass over.
Builds on Locating roots and iteration and Second order equations.
IN THIS TOPIC
- Quote and apply the forward and central difference formulae for dy/dx.
- Step a first or second order equation forward with a stated step length h.
- Apply Simpson's rule with an even number of strips and judge its accuracy.
WHAT YOU PROBABLY THINK
A differential equation with no closed-form solution cannot be evaluated at a particular point.
Derivatives as differences
Over a short step h, a derivative is nearly a gradient between two sampled points. Two approximations for the first derivative carry most of the topic:
with the second derivative approximated by (yn+1 − 2yn + yn-1)/h². The first is the forward difference, using the step ahead; the second is the central difference, using a step each side, and it is the more accurate for the same h. Rearranged for yn+1, each becomes a recipe for the next value, so a solution nobody can write down can still be tabulated. The opening claim mistakes 'no formula' for 'no values'.
WORKED EXAMPLE
Two steps, two methods
For dy/dx = x + y with y = 1 at x = 0 and h = 0.1, estimate y at x = 0.2.
Forward difference: y₁ = 1 + 0.1(0 + 1) = 1.1, then y₂ = 1.1 + 0.1(0.1 + 1.1) = 1.22.
Central difference from x = 0.1: y₂ = y₀ + 2h(x₁ + y₁) = 1 + 0.2(1.2) = 1.24.
The exact solution 2e0.2 − 1.2 is 1.2428, so the central difference is out by 0.003 where the forward difference is out by 0.023: nearly ten times better, from the same two evaluations.
For a second order equation, substitute the second-derivative approximation and rearrange for yn+1: the new value needs the two before it, so the first step comes from the initial conditions rather than the recurrence.
Simpson's rule
Where the trapezium rule joins sample points with straight lines, Simpson's rule threads a parabola through each consecutive triple, which is why the strips must come in pairs:
The 1, 4, 2, 4, …, 4, 1 pattern of weights is the signature to check before evaluating: ends weighted 1, odd-indexed points 4, even-indexed interior points 2. An odd number of strips leaves a parabola with nothing to fit, so the rule simply does not apply.
WORKED EXAMPLE
π to five decimal places, from four strips
Use Simpson's rule with four strips to estimate ∫1/(1 + x²) dx from 0 to 1.
h = 0.25 and the five ordinates are 1, 0.941176, 0.8, 0.64, 0.5.
Weighted sum: 1 + 4(0.941176) + 2(0.8) + 4(0.64) + 0.5 = 9.424706.
Multiply by h/3: 0.785392. The exact value is π/4 = 0.785398, so four strips are already accurate to five decimal places.
YOUR TURN
One step of a second order equation
For y'' = x − y with y = 2 at x = 0 and y = 2.1 at x = 0.1, use the central second-difference approximation with h = 0.1 to estimate y at x = 0.2.
Show the working
The approximation gives (y₂ − 2y₁ + y₀)/h² = x₁ − y₁.
So y₂ = 2y₁ − y₀ + h²(x₁ − y₁) = 4.2 − 2 + 0.01(0.1 − 2.1).
y₂ = 2.2 − 0.02 = 2.18. Two starting values were needed, which is why second order problems always supply them.
THE EXAM BIT
- Quote the difference formula you are using before substituting; the choice is itself a method mark.
- Work to more decimal places than the answer demands, then round once at the end.
- Simpson's rule needs an even number of strips, so an odd number of intervals is a misread question.
- Lay the arithmetic out as a table of x and y values; examiners follow tables, not paragraphs.
CHECK YOURSELF
Using the forward difference with h = 0.2, take one step of dy/dx = y − x from y = 1 at x = 0.
Show a hint
y₁ = y₀ + h × (dy/dx at the start).
Show the answer
T
h
e
g
r
a
d
i
e
n
t
a
t
t
h
e
s
t
a
r
t
i
s
1
−
0
=
1
,
s
o
y
₁
=
1
+
0
.
2
=
1
.
2
a
t
x
=
0
.
2
.
O
n
e
s
t
e
p
,
o
n
e
g
r
a
d
i
e
n
t
,
n
o
l
o
o
k
a
h
e
a
d
.
Forward difference steps ahead; the central difference straddles the point and is the more accurate.
Simpson: h/3 with weights 1, 4, 2, …, 4, 1, and an even number of strips or no rule at all.
WORKBOOK
Printable practice for this topic: original exam-style questions with room to work, and a fully worked answer book. Free to use; please do not redistribute or sell.
CHECK YOUR PROGRESS
Rate how confident you feel with each objective for this lesson. Ratings are saved in this browser, on this device only.
- Quote and apply the forward and central difference formulae for dy/dx.
- Step a first or second order equation forward with a stated step length h.
- Apply Simpson's rule with an even number of strips and judge its accuracy.
Open the full revision checklist to see every objective in the course in one place.
No animated video for this topic yet; these notes stand alone.