Numerical solution of differential equations
Studying this course? Keep your progress in one place.
Key facts
- A numerical method starts at and moves in equal steps of step length , so .
- Forward difference (Euler): .
- Central difference: , which needs two starting values.
- Second-order equations use when there is no first derivative term.
- A smaller or a central difference gives a better estimate; measure it with percentage error.
Step length and approximations
Each derivative is replaced by a difference approximation using values of at equally spaced -values.
Many differential equations cannot be solved exactly. A numerical method starts from a known point and moves in equal steps of step length . The notation means the approximation to .
Each derivative is replaced by a difference approximation using nearby values , , . Smaller steps usually give more accurate results but need more calculation.
- Forward
- Central
- Second derivative
- 1
Start
Use the known point (x₀, y₀)
- 2
Choose h
Fix the step length
- 3
Apply the formula
Compute the next y from earlier values
- 4
Update
Move on to the next x and repeat
If and , what is ?
Forward difference (Euler)
Euler's method steps forward using the gradient at the start of each interval.
Substituting the forward difference into and rearranging gives . This is Euler's method.
Each step uses the gradient at the start of the interval, so errors build up. Set out a table of , , and so no step is skipped.
Worked example
, , . Find and the percentage error, given the exact solution .
- 1
.
- 2
.
- 3
.
- 4
Exact value: .
- 5
Percentage error: .
For , , , what is ?
Central difference method
The central difference is centred on , so it is more accurate, but it needs two starting values.
The central difference is more accurate than the forward difference because it is centred on .
Substituting into gives .
Every step looks back two values, so you need and . Find by the forward difference method.
- Central difference step
Worked example
, , . Find .
- 1
Forward difference for the first step: .
- 2
.
- 3
.
Why must be found separately in the central difference method?
Second-order equations
Replace by its difference approximation, and any by the central difference.
For a second-order equation , replace the second derivative by . This gives .
If the equation also contains , replace it by the central difference too. Multiply through by to clear fractions, then collect the , and terms.
- Second-order step
Worked example
Find a recurrence for with .
- 1
Substitute: .
- 2
Multiply by : .
For with , what is the recurrence?
Starting a second-order method
Use the central difference at with the initial conditions to find and the extra value .
The formula needs and , but the initial conditions give and at .
Use the central difference at : . This brings in . Write the recurrence with and solve the two equations for and .
A simpler start is .
- 1
Central difference at n = 0
Links y₁ and y₋₁ to the gradient
- 2
Recurrence at n = 0
A second equation in y₁ and y₋₁
- 3
Solve
Find y₁, then carry on with the recurrence
Worked example
, at , , and . Find and .
- 1
Central difference at : .
- 2
Recurrence at : , so .
- 3
Then , so .
- 4
.
With and at , why is wrong?
Judging accuracy
Compare with the exact value using percentage error, and improve it with a smaller step or a central difference.
Compare an estimate with an exact value using the percentage error: .
Errors grow as more steps are taken. To improve an estimate, use a smaller step length , so each difference approximation is closer to the true derivative, or use the central difference rather than the forward difference. Always say why.
- Percentage error
Worked example
, , , . Estimate and find the percentage error, given the exact value .
- 1
Substitute both central differences and multiply by : .
- 2
At , gives , so and .
- 3
At : , so .
- 4
Percentage error: .
Which change would improve a numerical estimate?
Try an exam question
The differential equation has when . Use the forward difference method with step length to estimate when . State one way to improve the estimate.
[4 marks]
- [1]Uses .
- [1].
- [1].
- [1]Use a smaller step length (or the central difference method), as this approximates the derivative more closely.
That's the notes covered.
Carry on to the next subtopic.
Try a question
Find the approximation to .
1 mark, marked against the mark scheme
Find the approximation to .
1 mark, marked against the mark scheme