Differential-Equations Β· Unit 2 Β· Video 6 Β· Interactive Practice

Pay Per Slope: RK4, Fourth-Order Error, and Why Nothing Is Free

IKey Formulas

ErrorMethodEvaluations of ff per step
eβ‰ˆC1he \approx C_1 hEuler11 — the slope where you stand
eβ‰ˆC2h2e \approx C_2 h^2Improved Euler (RK2)22AnA_n and BnB_n
eβ‰ˆC4h4e \approx C_4 h^4RK444An,Bn,Cn,DnA_n, B_n, C_n, D_n
yn+1=yn+hβ‹…An+2Bn+2Cn+Dn6y_{n+1} = y_n + h \cdot \dfrac{A_n + 2B_n + 2C_n + D_n}{6}The RK4 stepWeights 1,2,2,11, 2, 2, 1 sum to 66

Key Insight: Roughly, the number of evaluations per step is the power of hh in the error β€” and the trade is even. Cutting the error to 116\tfrac{1}{16} costs 88 evaluations per stretch of width hh whether you halve hh in RK4 or quarter it in RK2, where RK2 at step hh spent 22.

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,11, 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,C4C_1, C_2, C_4 are different numbers, so each ray measures a method against its own error at step hh; 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β‰ˆC4h4e \approx C_4 h^4. You replace hh by h2\tfrac{h}{2} β€” find the new error estimate.

βœ… Correct! C4(h2)4=116C4h4C_4\left(\tfrac{h}{2}\right)^4 = \tfrac{1}{16}C_4h^4 β€” fourth order means the error drops by a factor of sixteen.
❌ That is second-order behaviour. 14\tfrac{1}{4} is what the improved method gives, since (h2)2=h24\left(\tfrac{h}{2}\right)^2 = \tfrac{h^2}{4}. RK4 carries a fourth power.
❌ Check the exponent. 18=(12)3\tfrac{1}{8} = \left(\tfrac{1}{2}\right)^3 β€” you cubed rather than raised to the fourth power.
❌ Not quite. The whole step size sits inside the fourth power: compute (h2)4\left(\tfrac{h}{2}\right)^4, not h42\tfrac{h^4}{2}.
Show solution

Substitute h2\tfrac{h}{2} for hh in the error estimate:

eβ‰ˆC4(h2)4=C4β‹…h424=116 C4h4e \approx C_4\left(\frac{h}{2}\right)^4 = C_4 \cdot \frac{h^4}{2^4} = \frac{1}{16}\, C_4 h^4

Every halving of the step divides a pp-th order error by 2p2^p: by 22 for Euler, by 44 for the improved method, by 16 for RK4.

Problem 2 Β· Counting the Bill

Given: one RK4 step of width hh covers a stretch of the xx-axis using 44 evaluations of ff. You halve the step, so two RK4 steps now cover that same stretch.

How many evaluations of ff does the stretch now cost?

The improved method at step hh covered that stretch with 22 evaluations. The count has risen by a factor of:

βœ… Correct! 8=4Γ—28 = 4 \times 2: a sixteenth of the error, bought with four times the evaluations.
❌ That is the improved method's bill. 22 evaluations is what RK2 spends on the stretch at step hh; RK4 reads the field four times in every step.
❌ That is one step's worth. Halving hh puts two RK4 steps on the stretch, each costing 44.
❌ Too many steps. 16=4Γ—416 = 4 \times 4 would be four steps; halving hh produces two.
❌ Not quite. Count steps first, then multiply by the evaluations each step costs.
❌ That is RK4 against itself. 8÷4=28 \div 4 = 2 compares with RK4 at step hh; here the comparison is with the improved method's 22.
❌ That is the count, not the ratio. 88 is the new bill; divide it by the 22 the improved method spent.
❌ That is the error factor. The error fell by 1616; the work rose by much less.
❌ Not quite. Divide the new evaluation count by the 22 the improved method spent on the same stretch.
Show solution

Step 1 β€” the new bill. Where one step of width hh stood there are now two of width h2\tfrac{h}{2}, and each evaluates ff four times:

2Β stepsΓ—4Β evaluations=82 \text{ steps} \times 4 \text{ evaluations} = 8

Step 2 β€” the comparison. The improved method crossed the same stretch in one step of width hh, for 22 evaluations:

82=4\frac{8}{2} = 4

So the ledger reads errorΓ·16\text{error} \div 16, Β evaluationsΓ—4\ \text{evaluations} \times 4. The accuracy is bought, not given.

Problem 3 Β· One RK4 Step

Given: an RK4 step starting at yn=3.0y_n = 3.0 with h=0.5h = 0.5 produces the four slopes An=0.6A_n = 0.6, Bn=1.2B_n = 1.2, Cn=1.4C_n = 1.4, Dn=1.4D_n = 1.4 β€” find the super slope and then yn+1y_{n+1}.

What is the super slope?

What is yn+1y_{n+1}?

βœ… Correct! 7.26=1.2\tfrac{7.2}{6} = 1.2, and 3.0+0.5(1.2)=3.63.0 + 0.5(1.2) = 3.6.
❌ That is the unweighted average. 0.6+1.2+1.4+1.44=1.15\tfrac{0.6 + 1.2 + 1.4 + 1.4}{4} = 1.15, but BnB_n and CnC_n are each counted twice.
❌ Wrong denominator. 7.24=1.8\tfrac{7.2}{4} = 1.8 divides by the number of slopes; a weighted average divides by the sum of the weights, 1+2+2+1=61 + 2 + 2 + 1 = 6.
❌ That is the weighted sum. 7.27.2 still has to be divided by 66 to become an average.
❌ The step size is missing. 3.0+1.2=4.23.0 + 1.2 = 4.2 adds the slope itself; the update adds hh times the slope.
❌ Not quite. Weight the slopes 1,2,2,11, 2, 2, 1, add them, and divide by 66.
❌ Not quite. Use yn+1=yn+hβ‹…(superΒ slope)y_{n+1} = y_n + h \cdot (\text{super slope}) with h=0.5h = 0.5.
Show solution

Step 1 β€” the weighted sum.

An+2Bn+2Cn+Dn=0.6+2(1.2)+2(1.4)+1.4=0.6+2.4+2.8+1.4=7.2A_n + 2B_n + 2C_n + D_n = 0.6 + 2(1.2) + 2(1.4) + 1.4 = 0.6 + 2.4 + 2.8 + 1.4 = 7.2

Step 2 β€” divide by the sum of the weights. The weights are 1,2,2,11, 2, 2, 1 and 1+2+2+1=61 + 2 + 2 + 1 = 6:

superΒ slope=7.26=1.2\text{super slope} = \frac{7.2}{6} = 1.2

Step 3 β€” take the step.

yn+1=yn+hβ‹…An+2Bn+2Cn+Dn6=3.0+0.5(1.2)=3.6y_{n+1} = y_n + h \cdot \frac{A_n + 2B_n + 2C_n + D_n}{6} = 3.0 + 0.5(1.2) = 3.6

Why 66? If all four slopes were equal to some mm, the sum would be m+2m+2m+m=6mm + 2m + 2m + m = 6m, and 6m6=m\tfrac{6m}{6} = 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 33 times per step and has error eβ‰ˆC3h3e \approx C_3 h^3. You halve its step β€” find the new error factor and the new cost of one stretch of width hh (which used to cost 33 evaluations).

The error is now what fraction of what it was?

How many evaluations of ff does the stretch now cost?

βœ… Correct! (12)3=18\left(\tfrac{1}{2}\right)^3 = \tfrac{1}{8} of the error for 2Γ—3=62 \times 3 = 6 evaluations β€” twice the work. The same kind of bargain, in a third-order currency.
❌ The order is an exponent, not a multiplier. 16\tfrac{1}{6} multiplies 22 by 33; the factor is (12)3\left(\tfrac{1}{2}\right)^3.
❌ That is second-order behaviour. 14=(12)2\tfrac{1}{4} = \left(\tfrac{1}{2}\right)^2; this method carries a cube.
❌ Not a division by the order. Halving hh multiplies h3h^3 by (12)3\left(\tfrac{1}{2}\right)^3.
❌ Not quite. Put h2\tfrac{h}{2} into C3h3C_3h^3 and read off the numerical factor.
❌ That is the old bill. 33 evaluations covered the stretch in one step; halving hh needs two steps.
❌ That is RK4's bill. 8=2Γ—48 = 2 \times 4 belongs to a method reading four times per step; this one reads three.
❌ Too many steps. 12=4Γ—312 = 4 \times 3 would be four steps; halving hh 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(h2)3=C3β‹…h38=18 C3h3C_3\left(\frac{h}{2}\right)^3 = C_3 \cdot \frac{h^3}{8} = \frac{1}{8}\, C_3 h^3

Step 2 β€” the bill. Two steps of width h2\tfrac{h}{2} replace one of width hh, at 33 evaluations each:

2Β stepsΓ—3Β evaluations=62 \text{ steps} \times 3 \text{ evaluations} = 6

So 18\tfrac{1}{8} of the error for 2Γ—2\times the work. Compare RK4, which halves hh for 116\tfrac{1}{16} of the error at 2Γ—2\times its own work, and Euler, which halves hh for only 12\tfrac{1}{2} of the error at the same 2Γ—2\times. Higher order buys a steeper discount for the same doubling β€” but a discount, never a gift.

Solved: 0 / 4