Loading...
Loading...
Differential Equations · Axiom Academy
Heun's predictor-corrector idea: average the slope at both ends of a step to jump from first-order to second-order accuracy. Euler's method takes the slope f(x_n, y_n) at the left endpoint of the interval and rides that single tangent line for the whole step: Over the step, the true solution curve bends away from that tangent — the slope at the end of the interval is usually different from the slope at the start. Using only the starting slope is why the local error is O(h^2) per step and the accumulated (global) error is only O(h) . Heun's method runs two stages per step. Stage one predicts an endpoint the ordinary Euler way — using a tilde ( ) to mark it as provisional: Stage two evaluates the slope at that predicted point , then averages it with the original starting slope — that average is a far better estimate of the slope across the whole interval than either endpoint alone: 3. One Heun Step, Worked Numerically Apply Heun's method to the same problem from the Euler's Method lesson: y' = x + y , y(0) = 1 , step size h = 0.1 . First, the predictor (identical to a plain Euler step): Now evaluate the slope at that predicted point and average it with the starting slope: Marching four steps out to x=0.4 (exact solution y(x)=2e^x-x-1 ) shows the gap widen in Heun's favor as error accumulates: 4. Why Second-Order? The Trapezoid Connection Integrating the ODE across one step gives an exact expression for the true change in y :
This is the written version of the interactive lesson above. See the full Differential Equations course.