How to Use
Set up the IVP:
- dy/dx=f(x,y): Choose ODE
- y(x₀)=y₀: Initial condition
- h: Step size
The k-Values
- k₁: slope at start
- k₂: slope at midpoint using k₁
- k₃: slope at midpoint using k₂
- k₄: slope at end using k₃
- Weighted average: (1+2+2+1)/6
vs Euler
RK4 is O(h⁴) globally vs Euler's O(h). With h=0.1, RK4 gives ~10⁻⁴ error where Euler gives ~10⁻¹. RK4 needs 4 function evaluations per step vs Euler's 1.
Step-by-Step Instructions
- 1Select an ODE.
- 2Set initial condition.
- 3Choose step size.
- 4View k-values.
- 5Compare with exact.