ODE Numerical Methods Back EN · ZH
Numerical Methods

ODE Numerical Methods Comparison

Compare Euler, Heun (RK2), and RK4 side by side. Adjust step size h and watch the global error against the exact solution update in real time.

Parameters
ODE Type
Decay rate k 1.00
Initial value y₀ 1.00
Step size h 0.10
Range: 0.001 to 1.0 (log scale)
Time span T 10.0

Order of Accuracy

Global Error:

Euler: $\mathcal{O}(h)$  |  RK2: $\mathcal{O}(h^2)$  |  RK4: $\mathcal{O}(h^4)$

Euler Max Error
RK2 Max Error
RK4 Max Error
Steps
Global Error |y_num − y_exact| vs t

Method Formulas

Euler (1st order):

$$y_{n+1} = y_n + h\,f(t_n,\,y_n)$$

Heun / RK2 (2nd order):

$$k_1 = f(t_n,y_n),\quad k_2 = f(t_n+h,\,y_n+hk_1)$$ $$y_{n+1} = y_n + \tfrac{h}{2}(k_1+k_2)$$

Runge-Kutta 4th order:

$$k_1=f(t_n,y_n),\; k_2=f\!\left(t_n+\tfrac{h}{2},y_n+\tfrac{h}{2}k_1\right)$$ $$k_3=f\!\left(t_n+\tfrac{h}{2},y_n+\tfrac{h}{2}k_2\right),\; k_4=f(t_n+h,y_n+hk_3)$$ $$y_{n+1}=y_n+\tfrac{h}{6}(k_1+2k_2+2k_3+k_4)$$
CAE Relevance: FEM time-integration schemes (Newmark-β, central difference) are direct applications of ODE solvers. LS-DYNA's explicit solver requires Δt < Δtcr = 2/ωmax for stability. RK4 is used as a reference algorithm in implicit solvers such as ABAQUS.