1. The RK4 Formula

Theorem – Classical Runge–Kutta 4th order

For , :




Interpretation

SlopeWhere it is evaluatedUsesWeight
start of step–1
midpoint2
midpoint (improved)2
end of step1

The step uses the weighted average slope . (Extra: the weights over start/middle/end are Simpson’s 1/3 rule from 5.2 applied to the slope.)

flowchart LR
    K1["k₁ at xᵢ"] --> K2["k₂ at xᵢ + h/2<br/>using k₁"]
    K2 --> K3["k₃ at xᵢ + h/2<br/>using k₂"]
    K3 --> K4["k₄ at xᵢ + h<br/>using k₃"]
    K4 --> Y["yᵢ₊₁ = yᵢ + h(k₁ + 2k₂ + 2k₃ + k₄)/6"]

⚠️ and are evaluated at the same (the midpoint) but with different : uses , uses . And steps a full using , not .


2. Worked Example – Cooling Ball

Example (slides)

⚠️ The slide’s problem statement says “Runge–Kutta 2nd order”; this section is the 4th-order method.

Step 1: ,

SlopeEvaluated atValue

Step 2: ,

SlopeEvaluated atValue

⚠️ Slide typo in step 2: it writes inside ; it must be the current value (the numbers on the slide do use 675.65).

Exact: K.

RK4 vs Heun vs Euler, h = 240012024036048003006009001200t (s)θ (K)exact (θ(480)=647.57)RK4HeunEuler


3. Effect of Step Size

Table (slides)

(s) %
480−90.278737.85113.94
240594.9152.6608.1319
120646.161.41220.21807
60647.540.0336260.0051926
30647.570.000869000.00013419

Once , each halving of divides the error by ≈ 40 here, much faster than Euler’s ≈ 2 or RK2’s ≈ 4.


4. Comparison of All ODE Methods

, exact K (slides + extra RK4 column)

(s)EulerHeunMidpointRalstonRK4
480−987.84−393.871208.4449.78−90.278
240110.32584.27976.87690.01594.91
120546.77651.35690.20667.71646.16
60614.97649.91654.85652.25647.54
30632.77648.21649.02648.61647.57
MethodSlopes per stepGlobal error order
Euler1
RK2 (Heun / Midpoint / Ralston)2
RK44

⚠️ At the very coarse , Ralston (error 42 K) actually beats RK4 (error 53 K). High order guarantees fast improvement as ; it doesn’t guarantee being best at every large . From down, RK4 is by far the most accurate.

⚠️ Cost comparison: RK4 with uses 16 evaluations of and is off by 1.4 K. Euler with uses 16 evaluations too and is off by 14.8 K. For the same work, RK4 is about 10× more accurate here.