Source
Adapted from my own handwritten and hand-typed notes from Year 1 to Year 3 of my EEE degree
The classical fourth order Runge-Kutta method (RK4) is the most accurate method in the course and is widely used in practice. Each step samples the slope four times and takes a weighted average.
Formula
For , :
What each term means:
- : slope at the start of the step
- , : two estimates of the slope at the midpoint (weighted double)
- : slope at the end of the step
Error
Local truncation error and global error , so it is fourth order. Halving cuts the error by about 16 times.
Worked example
, , , first step:
| 0.2 | 0.4 | 0.6 | 0.8 | 1.0 | |
|---|---|---|---|---|---|
| RK4 | 0.021400 | 0.091818 | 0.222106 | 0.425521 | 0.718251 |
| exact | 0.021403 | 0.091825 | 0.222119 | 0.425541 | 0.718282 |
Comparison of methods
| Method | Slope evaluations per step | Order (global error) |
|---|---|---|
| Euler | 1 | |
| Improved Euler | 2 | |
| RK4 | 4 |
All three methods extend directly to Numerical Methods for ODE Systems.