1. General RK2 Form
Definition
For , :
Instead of Euler’s single slope, RK2 uses a weighted average of two slopes: one at the start, one at a trial point inside the step.
Theorem – Conditions on the parameters
The four unknowns must satisfy (stated without proof):
That’s 3 equations in 4 unknowns, so choose and compute the rest. (Extra: these conditions make RK2 agree with the Taylor series through the term, so the global error is .)
| Method | ||||
|---|---|---|---|---|
| Heun | ||||
| Midpoint | ||||
| Ralston |
2. The Three Classic Variants
Heun’s method ()
It predicts the end of the step with Euler, then averages the start and end slopes.
Midpoint method ()
It uses only the slope estimated at the middle of the step.
Ralston’s method ()
flowchart LR S["(xᵢ, yᵢ)"] --> K1["k₁ = f(xᵢ, yᵢ)"] K1 --> P["trial point<br/>(xᵢ + p₁h, yᵢ + q₁₁k₁h)"] P --> K2["k₂ = f(trial point)"] K2 --> N["yᵢ₊₁ = yᵢ + (a₁k₁ + a₂k₂)h"]
⚠️ With you’d get , i.e. Euler, but then is impossible. Euler is not a valid RK2 member; it’s only first order.
3. Worked Example – Cooling Ball (Heun)
Example (slides)
Step 1: ,
| Quantity | Computation | Value |
|---|---|---|
| trial point | ||
| K |
Step 2: ,
| Quantity | Computation | Value |
|---|---|---|
| K |
Exact: K. Heun’s error is K, compared with K for Euler at the same .
⚠️ Look at step 1: Euler alone would land at K (step 1 of 6.1). Heun uses that point only as a predictor; averaging the slopes pulls the result back to K.
Example (extra) – first step with the other two variants
| Method | Trial point | (K) | |
|---|---|---|---|
| Midpoint | |||
| Ralston |
4. Effect of Step Size
Heun (slides)
| (s) | % | ||
|---|---|---|---|
| 480 | −393.87 | 1041.4 | 160.82 |
| 240 | 584.27 | 63.304 | 9.7756 |
| 120 | 651.35 | −3.7762 | 0.58313 |
| 60 | 649.91 | −2.3406 | 0.36145 |
| 30 | 648.21 | −0.63219 | 0.097625 |
Comparison of Euler and the RK2 variants (slides)
| (s) | Euler | Heun | Midpoint | Ralston |
|---|---|---|---|---|
| 480 | −987.84 | −393.87 | 1208.4 | 449.78 |
| 240 | 110.32 | 584.27 | 976.87 | 690.01 |
| 120 | 546.77 | 651.35 | 690.20 | 667.71 |
| 60 | 614.97 | 649.91 | 654.85 | 652.25 |
| 30 | 632.77 | 648.21 | 649.02 | 648.61 |
Exact: K.
⚠️ For large , all methods are unreliable (Midpoint at even rises above 1200 K). Order-of-accuracy claims only hold once is “small enough”. At all three RK2 variants are within ≈ 1.5 K, while Euler is still 15 K off.