Runge-Kutta ODE Solver Visualizer
Compare Euler (RK1), Midpoint (RK2), and RK4 methods on classic ODEs. See how step size affects accuracy and stability — with the exact solution for reference.
Exact
Euler (RK1)
Midpoint (RK2)
RK4
Euler error: —
RK2 error: —
RK4 error: —
Runge-Kutta Methods
Euler (RK1): y_{n+1} = y_n + h·f(t_n, y_n) — O(h) local error, O(1) global. Simple but inaccurate.
Midpoint (RK2): Uses the slope at the midpoint of the interval — O(h²) local, O(h) global.
RK4: k₁=f(t,y), k₂=f(t+h/2,y+hk₁/2), k₃=f(t+h/2,y+hk₂/2), k₄=f(t+h,y+hk₃). y_{n+1}=y_n+h(k₁+2k₂+2k₃+k₄)/6 — O(h⁴) local error. The gold standard for non-stiff ODEs. For stiff systems (Van der Pol), even RK4 needs small steps.