Loading...
Loading...
Differential Equations · Axiom Academy
Four slopes, one weighted average, and why the 1-2-2-1 pattern buys a full order of accuracy over Euler's method. Given the initial value problem y' = f(x,y) with y(x_0) = y_0 , we want to step forward to y(x_0+h) . Euler's method commits to the slope at just the starting point and follows it the whole way across: Watch what happens: the true solution curves away from that single tangent line, so the further we follow it, the worse the landing point gets. RK4 evaluates f four times per step, each time using the PREVIOUS sample's prediction to decide where to look next: Watch each slope sample land in turn — k_1 at the known start, k_2 and k_3 both at the midpoint (but using different predicted heights), and k_4 at the end using k_3 's prediction: 3. The 1-2-2-1 Weighted Average The four slopes are combined into a single "effective slope" using specific weights, then that blended slope is used exactly like Euler's method used its one slope: Watch the four weighted contributions stack — the midpoint slopes k_2,k_3 each count double : Matching the RK4 weighted average against the Taylor expansion of the true solution shows the two agree through the h^4 term — the local truncation error (the error in a single step) is only O(h^5) : Watch how the GLOBAL error (accumulated over many steps to a fixed endpoint) shrinks as h is halved, for Euler's one-slope method versus RK4's four-slope method:
This is the written version of the interactive lesson above. See the full Differential Equations course.