Differential-Equations Β· Unit 2 Β· Video 6 Β· Interactive Practice
Pay Per Slope: RK4, Fourth-Order Error, and Why Nothing Is Free
IKey Formulas
Error
Method
Evaluations of f per step
eβC1βh
Euler
1 — the slope where you stand
eβC2βh2
Improved Euler (RK2)
2 — Anβ and Bnβ
eβC4βh4
RK4
4 — Anβ,Bnβ,Cnβ,Dnβ
yn+1β=ynβ+hβ 6Anβ+2Bnβ+2Cnβ+Dnββ
The RK4 step
Weights 1,2,2,1 sum to 6
Key Insight: Roughly, the number of evaluations per step is the power of h in the error β and the trade is even. Cutting the error to 161β costs 8 evaluations per stretch of width h whether you halve h in RK4 or quarter it in RK2, where RK2 at step h spent 2.
IIVisualization 1 β Counting the Readings
Each step reads the direction field once, twice, or four times, and the accuracy follows the count.
The exact curve here is itself an RK4 computation, run at a step so small that its own error sits below the width of the drawn line.
IIIVisualization 2 β The Super Slope
RK4 spends its four readings on a single weighted average, with weights 1,2,2,1.
IVVisualization 3 β What a Sixteenth Costs
Every method can buy a sixteenth of its own error; the question is what each one charges.
The constants C1β,C2β,C4β are different numbers, so each ray measures a method against its own error at step h; the three heights are not comparable with one another.
VQuiz Questions
Problem 1 Β· Halving the Step in RK4
Given: RK4's error over a fixed interval is eβC4βh4. You replace h by 2hβ β find the new error estimate.
β Correct!C4β(2hβ)4=161βC4βh4 β fourth order means the error drops by a factor of sixteen.
β That is second-order behaviour.41β is what the improved method gives, since (2hβ)2=4h2β. RK4 carries a fourth power.
β Check the exponent.81β=(21β)3 β you cubed rather than raised to the fourth power.
β Not quite. The whole step size sits inside the fourth power: compute (2hβ)4, not 2h4β.
Show solution
Substitute 2hβ for h in the error estimate:
eβC4β(2hβ)4=C4ββ 24h4β=161βC4βh4
Every halving of the step divides a p-th order error by 2p: by 2 for Euler, by 4 for the improved method, by 16 for RK4.
Problem 2 Β· Counting the Bill
Given: one RK4 step of width h covers a stretch of the x-axis using 4 evaluations of f. You halve the step, so two RK4 steps now cover that same stretch.
How many evaluations of f does the stretch now cost?
The improved method at step h covered that stretch with 2 evaluations. The count has risen by a factor of:
β Correct!8=4Γ2: a sixteenth of the error, bought with four times the evaluations.
β That is the improved method's bill.2 evaluations is what RK2 spends on the stretch at step h; RK4 reads the field four times in every step.
β That is one step's worth. Halving h puts two RK4 steps on the stretch, each costing 4.
β Too many steps.16=4Γ4 would be four steps; halving h produces two.
β Not quite. Count steps first, then multiply by the evaluations each step costs.
β That is RK4 against itself.8Γ·4=2 compares with RK4 at step h; here the comparison is with the improved method's 2.
β That is the count, not the ratio.8 is the new bill; divide it by the 2 the improved method spent.
β That is the error factor. The error fell by 16; the work rose by much less.
β Not quite. Divide the new evaluation count by the 2 the improved method spent on the same stretch.
Show solution
Step 1 β the new bill. Where one step of width h stood there are now two of width 2hβ, and each evaluates f four times:
2Β stepsΓ4Β evaluations=8
Step 2 β the comparison. The improved method crossed the same stretch in one step of width h, for 2 evaluations:
28β=4
So the ledger reads errorΓ·16, Β evaluationsΓ4. The accuracy is bought, not given.
Problem 3 Β· One RK4 Step
Given: an RK4 step starting at ynβ=3.0 with h=0.5 produces the four slopes Anβ=0.6, Bnβ=1.2, Cnβ=1.4, Dnβ=1.4 β find the super slope and then yn+1β.
What is the super slope?
What is yn+1β?
β Correct!67.2β=1.2, and 3.0+0.5(1.2)=3.6.
β That is the unweighted average.40.6+1.2+1.4+1.4β=1.15, but Bnβ and Cnβ are each counted twice.
β Wrong denominator.47.2β=1.8 divides by the number of slopes; a weighted average divides by the sum of the weights, 1+2+2+1=6.
β That is the weighted sum.7.2 still has to be divided by 6 to become an average.
β The step size is missing.3.0+1.2=4.2 adds the slope itself; the update adds h times the slope.
β Not quite. Weight the slopes 1,2,2,1, add them, and divide by 6.
β Not quite. Use yn+1β=ynβ+hβ (superΒ slope) with h=0.5.
Why 6? If all four slopes were equal to some m, the sum would be m+2m+2m+m=6m, and 66mβ=m β the average of four equal slopes has to be that slope.
Problem 4 Β· A Third-Order Method
Given: a method reads the direction field 3 times per step and has error eβC3βh3. You halve its step β find the new error factor and the new cost of one stretch of width h (which used to cost 3 evaluations).
The error is now what fraction of what it was?
How many evaluations of f does the stretch now cost?
β Correct!(21β)3=81β of the error for 2Γ3=6 evaluations β twice the work. The same kind of bargain, in a third-order currency.
β The order is an exponent, not a multiplier.61β multiplies 2 by 3; the factor is (21β)3.
β That is second-order behaviour.41β=(21β)2; this method carries a cube.
β Not a division by the order. Halving h multiplies h3 by (21β)3.
β Not quite. Put 2hβ into C3βh3 and read off the numerical factor.
β That is the old bill.3 evaluations covered the stretch in one step; halving h needs two steps.
β That is RK4's bill.8=2Γ4 belongs to a method reading four times per step; this one reads three.
β Too many steps.12=4Γ3 would be four steps; halving h produces two.
β Not quite. Two steps now cover the stretch, and each one reads the field three times.
Show solution
Step 1 β the error.
C3β(2hβ)3=C3ββ 8h3β=81βC3βh3
Step 2 β the bill. Two steps of width 2hβ replace one of width h, at 3 evaluations each:
2Β stepsΓ3Β evaluations=6
So 81β of the error for 2Γ the work. Compare RK4, which halves h for 161β of the error at 2Γ its own work, and Euler, which halves h for only 21β of the error at the same 2Γ. Higher order buys a steeper discount for the same doubling β but a discount, never a gift.