Maths › Practise › Questions › Numerical methods for differential equations
Questions on numerical methods for differential equations
A finite-difference formula replaces a derivative by values on a grid. State the step length, use consistent indexing and retain sufficient precision between steps. Give the approximation order only with the required smoothness assumptions, and compare methods by the errors they actually produce.
16 original questions · 62 marks · the numerical methods for differential equations notes · Further Pure 1
To print: the questions (PDF, 85 KB) · the worked answers (PDF, 98 KB)
These are original InkMaths questions. Write a complete answer before opening the worked solution and marking guidance.
Write down the forward and central difference approximations to dy/dx at the point xn, and say which is more accurate.
Worked solution and marking guidance
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 solution and marking guidance
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 mid-ordinate rule for estimating ∫ y dx from a to b with n strips of width h, and say how many evaluations of y it needs compared with the trapezium rule on the same strips.
Worked solution and marking guidance
M = h(m1 + m2 + … + mn), where mr is the value of y at the centre of the rth strip. It needs n evaluations, one per strip, against n + 1 for the trapezium rule, which reads every strip edge. B1 for the rule, B1 for n against n + 1. There are no weights and no end terms: each strip is roofed flat at the height of its middle.Use Simpson's rule with two strips to estimate ∫ x³ dx from 0 to 1, and compare the estimate with the exact value.
Worked solution and marking guidance
h = 0.5 and the ordinates are 0, 0.125 and 1, so the estimate is (0.5/3)(0 + 4 × 0.125 + 1) = (0.5/3)(1.5) = 0.25, which is the exact value of the integral. M1 for the 1, 4, 1 weighting with h/3, A1 for 0.25 and the comparison. Simpson's rule fits parabolas, yet it is exact for every cubic, because the cubic part contributes equal and opposite errors either side of the middle ordinate.Write down the central difference approximation to the second derivative, and rearrange it to give yn+1.
Worked solution and marking guidance
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, which is why 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 solution and marking guidance
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 solution and marking guidance
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 solution and marking guidance
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.
Keep five decimal places through the working; rounding y₂ to 1.09 shifts y₃ in the third place.Use the mid-ordinate rule with four strips to estimate ∫ 1/(1 + x) dx from 0 to 1, giving four decimal places. The exact value is ln 2 = 0.6931. State whether the rule has overestimated or underestimated, and explain why from the shape of the curve.
Worked solution and marking guidance
h = 0.25, so the strip centres are 0.125, 0.375, 0.625 and 0.875, and the mid-ordinates are 1/1.125 = 0.888889, 1/1.375 = 0.727273, 1/1.625 = 0.615385 and 1/1.875 = 0.533333. Their sum is 2.764880, and multiplying by h gives 0.6912. B1 for the four centres, M1 for the mid-ordinates, A1 for 0.6912. That is below 0.6931, an underestimate. The second derivative of 1/(1 + x) is 2/(1 + x)³, positive throughout, so the curve is concave up; the flat roof on each strip sweeps the same area as the tangent at the strip's centre, and that tangent lies below a concave-up curve. B1 for the direction with the reason. Reading the ordinates at the strip edges instead of the centres gives the trapezium sum, a different rule with the opposite error.For dy/dx = x + y with y = 1 at x = 0 and y = 1.1103 at x = 0.1, use the central difference approximation (dy/dx)n is approximately (yn+1 − yn−1)/(2h) with h = 0.1 to estimate y at x = 0.2 and at x = 0.3, giving four decimal places.
Worked solution and marking guidance
Rearranged, yn+1 = yn−1 + 2h(xn + yn). M1 for the recurrence.
At n = 1: y₂ = 1 + 0.2(0.1 + 1.1103) = 1 + 0.24206 = 1.2421. A1.
At n = 2: y₃ = 1.1103 + 0.2(0.2 + 1.24206) = 1.1103 + 0.288412 = 1.3987. M1 for the second step using y₁ and y₂, A1.
The exact solution is y = 2ex − x − 1, which gives 1.2428 and 1.3997, so both estimates are within about 0.001.The central difference approximation yn+1 = yn−1 + 2h f(xn, yn) is to be used for a first order equation dy/dx = f(x, y) with a single initial condition at x0. Explain why it cannot start on its own, and say how the missing value is usually supplied.
Worked solution and marking guidance
The formula reaches back two values: to find y₂ it needs both y₁ and y0, and to find y₁ it would need y−1, which does not exist. A first order equation supplies only y0. B1 for the recurrence needing two earlier values, B1 for the initial condition supplying only one. The extra value y₁ is taken from the question when it gives one, and otherwise generated by a single step of another method, usually the forward difference y₁ = y0 + hf(x0, y0) or an improved Euler step, after which the central difference takes over. B1 for how y₁ is obtained. The accuracy of that first step matters, since every later value is built on it.The table shows the forward difference (Euler) method applied to the differential equation dy/dx = x + y, with the two entries still to be found in the last row marked ?. Use the table to state the step length h, complete the last row, and hence estimate the value of y when x = 0.4.
n xn yn (dy/dx)n = xn + yn 0 0 1 1 1 0.1 1.1 1.2 2 0.2 1.22 1.42 3 0.3 ? ? Worked solution and marking guidance
The x column climbs in equal steps 0, 0.1, 0.2, 0.3, so h = 0.1. B1 for the step length read from the table. Euler's method is yn+1 = yn + h(dy/dx)n, and the row n = 2 of the table supplies y2 = 1.22 and (dy/dx)2 = 1.42, so y3 = 1.22 + 0.1 × 1.42. M1 for the Euler step taken from the table's own entries. That gives y3 = 1.362, and the gradient beside it is x3 + y3 = 0.3 + 1.362 = 1.662. A1 for both missing entries. One more step reaches x = 0.4: y4 = 1.362 + 0.1 × 1.662. M1 for the further step. So y ≈ 1.5282 when x = 0.4. A1 for the value. Every step uses the gradient at the left-hand end of its interval, so for a solution bending upwards like this one each estimate falls short: the exact solution here is y = 2ex − x − 1, which gives 1.5836 at x = 0.4.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 solution and marking guidance
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.For ∫ 1/(1 + x) dx from 0 to 1, whose exact value is ln 2 = 0.693147, the trapezium rule with four strips gives 0.697024 and the mid-ordinate rule with the same strips gives 0.691220. Explain, from the curvature of y = 1/(1 + x), why one estimate is too large and the other too small, and state the assumptions under which the two rules can be relied on to straddle the true value in this way. Show that the errors are in the approximate ratio 2 : 1, and use that ratio to combine the two estimates into a better one.
Worked solution and marking guidance
The second derivative of 1/(1 + x) is 2/(1 + x)³, positive across [0, 1], so the curve is concave up throughout. B1 for the sign of the curvature. On each strip the trapezium chord joins two points of a concave-up curve and so lies above it, making the trapezium estimate too large; the mid-ordinate roof encloses the same area as the tangent at the strip's centre, which lies below the curve, making that estimate too small. B1 for the chord above and the tangent below.
The comparison assumes the function is twice differentiable and that its second derivative keeps one sign across the whole interval; where the concavity changes, strips contribute errors of both signs and neither conclusion follows. The 2 : 1 ratio is a limiting statement as h tends to zero, so it is approximate for any finite number of strips. B1 for the assumptions.
Errors: trapezium 0.697024 − 0.693147 = +0.003877, mid-ordinate 0.691220 − 0.693147 = −0.001927, and 0.003877/0.001927 = 2.01, so the trapezium error is about twice the mid-ordinate error and of the opposite sign. M1 for both errors, A1 for the ratio.
If T − I is about 2(I − M), then 3I is about 2M + T, so I is about (2M + T)/3 = (1.382440 + 0.697024)/3 = 0.693155, within 0.00001 of ln 2. A1. That weighting is Simpson's rule in disguise: two parts mid-ordinate to one part trapezium is exactly the 1, 4, 1 pattern applied to the doubled set of ordinates.The equation dy/dx = y with y = 1 at x = 0 has exact solution y = ex. Show that n steps of the forward difference (Euler) method with step length h = 1/n give the estimate y(1) of (1 + 1/n)n. Evaluate this for n = 4 and for n = 8, compare each with e = 2.718282, and explain what the two errors show about the method and what happens as n increases without limit.
Worked solution and marking guidance
Each step is yk+1 = yk + hyk = (1 + h)yk, so every step multiplies the current value by the same factor 1 + h. Starting from y0 = 1, after n steps yn = (1 + h)n = (1 + 1/n)n. M1 for the step as a constant multiplier, A1 for the closed form.
n = 4: 1.254 = 2.4414, error 0.2769. n = 8: 1.1258 = 2.5658, error 0.1525. A1 for both values with their errors.
Halving the step length has cut the error by a factor of about 1.8, close to 2: the error of the forward difference method is proportional to h, which is what makes it a first order method, so each halving of h roughly halves the error and eight steps are only twice as good as four. B1 for the interpretation.
As n increases without limit, (1 + 1/n)n tends to e, so the estimate tends to the exact value, though slowly. B1. The forward difference follows the tangent at the left of each step, and ex bends upwards, so every step lands short and the errors all have the same sign.The equation d²y/dx² = −y, with y = 1 and dy/dx = 0 at x = 0, has exact solution y = cos x. A student takes h = 0.1, uses the forward difference dy/dx = (y₁ − y0)/h at x = 0 to obtain y₁, and then uses the central second-difference approximation to obtain y₂ and y₃. Carry out that calculation, compare y₃ with cos 0.3 = 0.955336, and explain why the estimate is poor. Show that using the central difference dy/dx = (y₁ − y−1)/(2h) at x = 0 instead, together with the second-difference formula at x = 0, gives y₁ = 0.995, and find the improved y₃.
Worked solution and marking guidance
From (y₁ − y0)/0.1 = 0, y₁ = 1. The recurrence is yn+1 = 2yn − yn−1 + h²(−yn) = 2yn − yn−1 − 0.01yn. M1 for the start and the recurrence.
y₂ = 2 − 1 − 0.01 = 0.99, and y₃ = 1.98 − 1 − 0.0099 = 0.9701. A1. Against cos 0.3 = 0.955336 this is out by 0.015, poor for three steps of 0.1. The fault is the start: the forward difference has set y₁ = 1 when cos 0.1 = 0.995004, ignoring the curvature at x = 0 entirely, and the recurrence then carries that error forward with the step's own small errors added. B1 for identifying the starting value as the source.
With the central difference at x = 0, (y₁ − y−1)/0.2 = 0 gives y−1 = y₁. The second-difference formula at x = 0 is y₁ − 2y0 + y−1 = −h²y0, so 2y₁ − 2 = −0.01 and y₁ = 1 − 0.005 = 0.995. M1 for y−1 = y₁ substituted into the second difference, A1 for 0.995.
Then y₂ = 1.99 − 1 − 0.00995 = 0.98005 and y₃ = 1.9601 − 0.995 − 0.0098005 = 0.95530, against 0.955336: the error has fallen from 0.015 to 0.00004. A1.
All questions, worked solutions and marking guidance are original InkMaths material. They are not copied from awarding-body papers or mark schemes. The codes show how InkMaths allocates the stated total; an awarding body may credit a valid alternative method differently.
The same practice on paper: the printable workbook for this topic, with the questions and a worked answer book.
Practise numerical methods for differential equations one question at a time
In the player, mark your own response after viewing the worked solution. Your score decides when the question is offered again.