MATH 341 Differential Equations
  • Syllabus
  • Notes
  • Examples
  • Additional Topics
  • Python Reference

Numerical Methods Explorer

Equation x' = f(t, x)
Step size h = 0.50
0.05 1.0
Initial condition x(t₀) = 1.00
0.1 3.0
Methods shown
Methodh = 0.5h = 0.25h = 0.125Ratio (0.5/0.25)Order
Euler — O(h)
X_{n+1} = X_n
+ h·f(t_n, X_n)
1 function evaluation per step. Local error O(h²), global O(h). Halving h ≈ halves the error.
Modified Euler (RK2) — O(h²)
X̃ = X_n + h·f(t_n, X_n)
X_{n+1} = X_n + h/2·[f(t_n, X_n)
           + f(t_{n+1}, X̃)]
Predictor–corrector. 2 evaluations per step. Halving h ≈ quarters the error.
RK4 — O(h⁴)
k₁=f(tₙ,Xₙ)
k₂=f(tₙ+h/2, Xₙ+h/2·k₁)
k₃=f(tₙ+h/2, Xₙ+h/2·k₂)
k₄=f(tₙ+h, Xₙ+h·k₃)
X_{n+1}=Xₙ+h/6·(k₁+2k₂+2k₃+k₄)
4 evaluations per step. Halving h reduces error by factor ≈ 16.
Error at t = T for current h