Source
Adapted from my own handwritten and hand-typed notes from Year 1 to Year 3 of my EEE degree
Euler, improved Euler and RK4 all work for a system of first order ODEs: just apply the same formula to every component at the same time, using vectors. A higher order ODE is first rewritten as such a system.
System of first order ODEs
In vector form , .
Methods in vector form:
- Euler:
- improved Euler: , ,
- RK4: exactly as in the scalar case, then
Important: when computing , use the values of all components, for example . So find all first, then all , and so on.
Higher order ODE
For with , set
which gives
with .
Worked example
, , , . Estimate .
Solution:
- let , , so , , with ,
- Euler: and
- step 1: ,
- step 2: ,
- so Euler gives , while RK4 gives (exact )
The single equation version of RK4 is in Fourth Order Runge-Kutta Method.