Practise › Questions › Numerical methods for differential equations
Numerical methods for differential equations questions
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.
7 original questions · 25 marks · the numerical methods for differential equations notes · Further Pure 1
Every question here is written for this library rather than taken from a past paper. Write your answer out before opening the worked one: the answers award marks point by point, and the marks are easier to see when you have something of your own to compare against.
Write down the forward and central difference approximations to dy/dx at the point xn, and say which is more accurate.
Worked answer
Forward: (yn+1 − yn)/h. Central: (yn+1 − yn−1)/(2h). The central difference is the more accurate for the same step length, because it straddles the point rather than looking only ahead. B1 for the two differences, B1 for naming the central one with a reason.For dy/dx = x² + y with y = 1 at x = 0 and h = 0.1, use the forward difference to estimate y at x = 0.2.
Worked answer
First step: y₁ = 1 + 0.1(0 + 1) = 1.1. Second step: y₂ = 1.1 + 0.1(0.01 + 1.1) = 1.211. M1 for the Euler step, A1 for y₁, A1 for y₂. Each step reuses the previous value, so an early rounding error propagates through everything after it.Write down the central difference approximation to the second derivative, and rearrange it to give yn+1.
Worked answer
The approximation is (yn+1 − 2yn + yn−1)/h². Rearranged: yn+1 = 2yn − yn−1 + h² times the second derivative at xn. B1 for the approximation, M1 for rearranging, A1 for the result. Two previous values are needed, That is the reason a second order problem always supplies two starting conditions.Use Simpson's rule with four strips to estimate ∫ e−x² dx from 0 to 1, to 4 decimal places.
Worked answer
h = 0.25 and the ordinates are 1, 0.939413, 0.778801, 0.569783, 0.367879. The weighted sum with pattern 1, 4, 2, 4, 1 is 8.962265, and multiplying by h/3 gives 0.7469. B1 for h = 0.25, M1 for the ordinates, M1 for the 1, 4, 2, 4, 1 weighting, A1 for 0.7469. The true value is 0.7468, so four strips are accurate to three decimal places on a function with no elementary antiderivative.Explain why Simpson's rule requires an even number of strips.
Worked answer
The rule fits a parabola through each consecutive group of three ordinates, which uses up two strips at a time. An odd number leaves one strip with no partner and no parabola to fit, so the rule cannot be applied as it stands. B1 for a parabola through each group of three ordinates, B1 for strips being used two at a time.For y'' = 2x − y with y = 1 at x = 0 and y = 1.05 at x = 0.1, use the central second-difference approximation with h = 0.1 to estimate y at x = 0.2 and at x = 0.3.
Worked answer
Rearranged, yn+1 = 2yn − yn−1 + h²(2xn − yn).
At n = 1, with x₁ = 0.1: y₂ = 2(1.05) − 1 + 0.01(0.2 − 1.05) = 1.1 − 0.0085 = 1.09150.
At n = 2, with x₂ = 0.2: y₃ = 2(1.0915) − 1.05 + 0.01(0.4 − 1.0915) = 1.133 − 0.006915 = 1.12609.
M1 for the recurrence, M1 for the first step, A1 for y at 0.2, A1 for y at 0.3.
The recurrence needs the two values before it, so a second order problem always supplies two starting conditions. Keep five decimal places through the working; rounding y₂ to 1.09 shifts y₃ in the third place.For dy/dx = x² + y with y = 1 at x = 0, use the improved Euler method with h = 0.1 to estimate y at x = 0.2, giving your answer to five decimal places. The exact solution is y = 3ex − x² − 2x − 2. Compare the accuracy of your estimate with the value 1.211 obtained from the forward difference method with the same step length.
Worked answer
The improved Euler step is yn+1 = yn + ½(k₁ + k₂), with k₁ = hf(xn, yn) and k₂ = hf(xn + h, yn + k₁). The second increment is evaluated at the predicted point, not at the current one.
First step, from (0, 1):
k₁ = 0.1(0² + 1) = 0.1.
k₂ = 0.1(0.1² + 1.1) = 0.1(1.11) = 0.111.
y₁ = 1 + ½(0.1 + 0.111) = 1.1055.
Second step, from (0.1, 1.1055):
k₁ = 0.1(0.01 + 1.1055) = 0.11155.
k₂ = 0.1(0.04 + 1.21705) = 0.125705.
y₂ = 1.1055 + ½(0.11155 + 0.125705) = 1.1055 + 0.1186275 = 1.22413 to five decimal places.
Comparison. The exact value is 3e0.2 − 0.04 − 0.4 − 2 = 1.22421. The improved Euler estimate is out by about 0.00008; the forward difference value 1.211 is out by about 0.0132, roughly 160 times worse.
M1 for k₁ and k₂ with k₂ at the predicted point, A1 for k₂, A1 for y₁, M1 for the second step, A1 for 1.22413, B1 for the exact value, B1 for the comparison of errors.
The forward difference uses the gradient at the left end of each interval and so lags a curve that is bending upwards. Averaging the gradients at the two ends removes most of that lag, at the cost of one extra evaluation of the gradient per step.
The same practice on paper: the printable workbook for this topic, questions and a worked answer book.
Practise numerical methods for differential equations one question at a time
The player marks nothing for you. It shows one question, waits, then shows the worked answer so you can mark yourself, and brings a question back sooner when it went badly.