Improve on Euler's method with a predictor-corrector scheme: predict y* with Euler's slope, then correct using the average of slopes at both endpoints. Example: y'=x+y, y(0)=1, h=1/2; two steps give y(1)≈105/32≈3.28 versus true 2e−2≈3.44.

This achieves second-order accuracy O(h²) globally.

Example

Predict with Euler's slope, then correct with an averaged slope.

highlighted = computed this step

Step 1 — Set up

Set up Heun's predictor-corrector method.

y=x+yy(0)=1h=12y'= x+y \quad y( 0 )= 1 \quad h= \frac{1}{2}

Step 2 — Predictor 1

Predict step 1 with the Euler slope.

f0=0+1=1y=1+121=32f_0= 0 + 1 = 1 \quad y^*= 1 + \frac{1}{2} \cdot 1 = \hlmath{\frac{3}{2}}

Step 3 — Corrector 1

Correct step 1 by averaging endpoint slopes.

f=12+32=2fˉ=(1+2)/2=32f^*= \frac{1}{2} + \frac{3}{2} = 2 \quad \bar f=( 1 + 2 )/ 2 = \hlmath{\frac{3}{2}}

Step 4 — Update 1

Update y1 with the averaged slope.

y1=1+1232=74y_ 1 = 1 + \frac{1}{2} \cdot \frac{3}{2} = \hlmath{\frac{7}{4}}

Step 5 — Predictor 2

Predict step 2 with the Euler slope.

f0=12+74=94y=74+1294=238f_0= \frac{1}{2} + \frac{7}{4} = \frac{9}{4} \quad y^*= \frac{7}{4} + \frac{1}{2} \cdot \frac{9}{4} = \hlmath{\frac{23}{8}}

Step 6 — Corrector 2

Correct step 2 by averaging endpoint slopes.

f=1+238=318fˉ=(94+318)/2=4916f^*= 1 + \frac{23}{8} = \frac{31}{8} \quad \bar f=( \frac{9}{4} + \frac{31}{8} )/ 2 = \hlmath{\frac{49}{16}}

Step 7 — Update 2

Update y2 with the averaged slope.

y2=74+124916=10532y_ 2 = \frac{7}{4} + \frac{1}{2} \cdot \frac{49}{16} = \hlmath{\frac{105}{32}}

Step 8 — Result

State the Heun approximation.

y(1)=10532y( 1 )= \hlmath{\frac{105}{32}}
improved-euler-heun Heun's method uses two slope evaluations per step: Predictor: y* = y_n + h·f(x_n, y_n) Corrector: y_{n+1} = y_n + (h/2)·(f(x_n,y_n) + f(x_{n+1},y*))