Euler vs Runge–Kutta
Numerical ODE solvers step along a solution using only slope evaluations — and how they use them matters enormously. This demo integrates the same differential equation with Euler’s one-slope step and the classic four-stage Runge–Kutta method, plotting both against the exact solution. Drag the step size h and watch Euler’s curve peel away while RK4 hugs the truth even at coarse steps; the displayed global errors shrink like h for Euler but like h⁴ for RK4.
Runs 100% in your browser — simulations are computed locally on your device.
Read the full guide to this tool
Notes
- Euler: y ← y + h·f; one slope per step, global error O(h).
- RK4 blends four slope samples per step for global error O(h⁴) — halving h cuts the error 16-fold.
- For stiff equations even RK4 struggles; implicit methods take over there.
- Runs 100% in your browser — simulations are computed locally on your device.