Initial Value Problems for ODE
Published in
Jun 6, 2022
Here, we are discussing 4 common numerical methods.
- Euler 1st explicit approximation (1st order Taylor series approximation)
- 2nd order Taylor series approximation
- Heun’s method
- Runge-Kutta methods
Euler 1st explicit approximation (1st order Taylor series approximation) : O(h²)
2nd order Taylor series approximation: O(h³)
Heun’s method: O(h²)
Runge-Kutta methods
The 4th order Runge-Kutta method : O(h⁴)
Example: (in MATLAB)
Given: x’ = x-t²+1, for t=[0,2], and initial value x(0) = 0.5
Euler’s method
4th order Runge-Kutta method
Only need to modify the iterative part (line14~18).
It is easy to see that 4th order Runge-Kutta approximate the actual function much better, which is quite reasonable since regarding the error term, Euler’s method is of O(h²) and 4th order Runge-Kutta is of O(h⁴).