Definition · The improved Euler methodFrom (tₙ, yₙ) with step h: k₁ = f(tₙ, yₙ), then k₂ = f(tₙ + h, yₙ + h·k₁), then yₙ₊₁ = yₙ + h·(k₁ + k₂)/2.
Two slopes are read per step, so each step costs twice what an Euler step costs. The method is also called Heun's method.
Do one step by hand on y′ = y from y(0) = 1 with h = 1/4. The start slope is k₁ = 1. The trial value is 1 + (1/4)·1 = 5/4, so k₂ = 5/4. The average slope is (1 + 5/4)/2 = 9/8, and y₁ = 1 + (1/4)·(9/8) = 41/32. This is hand arithmetic from the formula; set T to 1/4 in the lab on y′ = y and the first row of its table reads 41/32. Plain Euler gave 5/4 = 40/32 for the same step, and e^(1/4) ≈ 1.28403, rounded, is nearer to 41/32 = 1.28125.
The equation where the step is the trapezoid rule
Take y′ = t². The right side does not mention y, so the trial value never matters: k₁ = tₙ² and k₂ = (tₙ + h)², and the step adds h·(tₙ² + (tₙ + h)²)/2. That is the trapezoid rule on one piece. Its error on a quadratic is exactly proportional to h², because the rule's error is h²·(f′(b) − f′(a))/12 and for f = t² that is h²·2/12 = h²/6.
y′ = t², y(0) = 0, exact y = t³/3, T = 1
h E(h) = h²/6 ratio to the next
1/4 1/96 4
1/8 1/384 4
1/16 1/1536
The lab prints exactly these errors and the ratios 4, 4, and names the order 2. Compare Euler on the same equation at the same h = 1/4: its error is 11/96, eleven times larger. Switch the Method menu to Euler to see 11/96, 23/384, 47/1536 appear in place of these.
Theorem · The improved method is second orderFor a right-hand side with continuous second derivatives, the improved method's error at a fixed T is approximately C·h², so halving h divides it by about 4.
As with first order in the previous lesson, the lab demonstrates this on chosen equations by exact ratios and does not prove it in general.
When the ratio is near 4 and is not 4
Change the equation to y′ = t⁴, with exact solution t⁵/5. The errors are 53/2560, 213/40960 and 853/655360, and the ratios are 848/213 ≈ 3.98122 and 3408/853 ≈ 3.99531, both rounded here. They climb towards 4 and are not 4, because the trapezoid error has a smaller term in h⁴ as well. On a cubic the exactness comes back: the error of the rule is h²·(f′(b) − f′(a))/12 with no further terms, and for y′ = t³ that is h²/4, so typing t^3 and t^4/4 into the lab gives 1/64, 1/256, 1/1024, with ratio 4 twice.
Example · Second order is not half the errorAt h = 1/4 on y′ = t² Euler's error is 11/96 and the improved method's is 1/96: eleven times smaller, not half. For an equal number of slope readings Euler with h = 1/8 (eight readings) has error 23/384, and the improved method with h = 1/4 (four steps of two readings, eight in all) has 1/96 = 4/384, nearly six times smaller.
The comparison keeps growing in the improved method's favour as the step shrinks, because its error falls by 4 each halving and Euler's falls by 2.
The lab's third preset runs the improved method on y′ = y. The true value is irrational, so the errors, ratios and order are all rounded, and the lab marks them with ≈.