seegongsik
Saved words
Engineering Mathematics

Step Size Decides the Error

Error shrinks by the method's order in the step size; accuracy versus stability versus cost

Every method in this bundle is bound by one promise: the error is roughly C times h to the power p, that is error≈C·hᵖ, where p is the order of the method. Euler is first order, RK2 second, RK4 and Simpson fourth. Why does this matter? Plot error against the step h on log-log axes and you get a straight line whose slope is exactly the order p. Order equals slope. So halving the step cuts a p-th order error by two to the power p — sixteenfold for a fourth-order method. Then can you just keep shrinking h forever? No. Make it too small and roundoff error rises from the floor, and explicit methods blow up once they cross a stability limit. On top of that the number of steps grows as 1/h, so the cost soars. In the end the real craft of numerical analysis is finding the balance between accuracy and cost.

The horizontal axis is log h, the vertical is log(error). Take the log of both sides of error=C·hᵖ and you get a straight line whose slope is exactly the order p. The three lines are first, second and fourth order. Use the segments to highlight one order and move the point along its line with the h slider. For the same drop in h, the fourth-order point falls far more steeply. Higher order means the error falls much faster for the same effort. This single chart is the map of the whole bundle.

By the order logic alone, sending h to 0 should send the error to 0 too. Reality differs. The total error is the truncation term C·h² plus the roundoff term ε/h. Shrink h and the first term falls but the second rises, so the curve traces a U-valley. Drag the h slider to the left end of the valley. The point turns red as it hits the roundoff floor and the error grows again. Nothing is infinitely precise. The bottom of the valley is the best that machine can do.

Accuracy is not the only wall. Take the decay equation y'=−ky with k=5 and solve it by explicit Euler. The band on top is the step axis. The green zone is stable and accurate, the red zone is unstable, with the boundary at h = 2/k = 0.4. Move the slider point inside the green and smaller steps cling to the true solution. But push past 0.4 into the red and, regardless of accuracy, the numerical solution flips sign and blows up. A small step is not only precision; it is also the safety line against divergence.

Now gather four methods on one plane to compare. The error lines of Euler (1st), RK2 (2nd), RK4 (4th) and Simpson (4th) are drawn together. Pick a method with the segments to highlight its line, and the h slider moves the point on every line at once. At large h the differences are small, but as h shrinks the higher-order methods become overwhelmingly more accurate. Even at the same 4th order, Simpson's line sits a touch below RK4 because its coefficient C is smaller. Order sets the slope, the coefficient sets the height.

The finale is the real-world tug of war. Two bars appear. The error = C·h² shrinks as you reduce h, while the cost = steps ∝ 1/h grows as you reduce h. The curve below is their weighted sum, the total badness. Drag the h slider to both extremes. One end is too much error, the other too much cost, and somewhere in the middle lies the sweet spot. Where the point turns green is the best step that satisfies precision and cost together. This is the conclusion the whole bundle was pointing to.

In PracticeEvery method in this bundle is bound by error≈C·hᵖ. Here p is the order, seen as the slope of the error-versus-h line on log-log axes. Order equals slope. A p-th order error drops by 2ᵖ when h is halved. But you cannot shrink h forever. Too small and roundoff error rises from the floor, while explicit methods blow up past a stability limit. On top of that the number of steps grows as 1/h, so cost soars. Real work, then, is finding the sweet spot where the weighted sum of error and cost is least. Taylor explains a single step's error, Euler, RK and Simpson set its order, and this lesson explains the overall convergence and its limits.
Engineering Mathematics
Was this helpful? Support seegongsik