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: ,

QuantityComputationValue
trial point
K

Step 2: ,

QuantityComputationValue
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

MethodTrial point (K)
Midpoint
Ralston

Heun (RK2) on the cooling ball012024036048003006009001200t (s)θ (K)exact (θ(480)=647.57)Heun h=240Heun h=120Euler h=240 (compare)


4. Effect of Step Size

Heun (slides)

(s) %
480−393.871041.4160.82
240584.2763.3049.7756
120651.35−3.77620.58313
60649.91−2.34060.36145
30648.21−0.632190.097625

Comparison of Euler and the RK2 variants (slides)

(s)EulerHeunMidpointRalston
480−987.84−393.871208.4449.78
240110.32584.27976.87690.01
120546.77651.35690.20667.71
60614.97649.91654.85652.25
30632.77648.21649.02648.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.