List of ODE solvers
Contents
List of ODE solvers#
Euler method#
Algorithm 1 (Euler method)
Inputs A function \(f\) and an initial condition \(y_0\)
Output A sequence of approximations \(y_n\) to the solution \(y(t)\)
Set \(y_0 = y(0)\)
For \(n = 0, 1, 2, \ldots\) do
Set \(y_{n+1} = y_n + hf(t_n, y_n)\)
Runge–Kutta method#
Algorithm 2 (Runge–Kutta method)
Inputs A function \(f\) and an initial condition \(y_0\)
Output A sequence of approximations \(y_n\) to the solution \(y(t)\)
Set \(y_0 = y(0)\)
For \(n = 0, 1, 2, \ldots\) do
Set \(k_1 = hf(t_n, y_n)\)
Set \(k_2 = hf(t_n + \frac{h}{2}, y_n + \frac{k_1}{2})\)
Set \(k_3 = hf(t_n + \frac{h}{2}, y_n + \frac{k_2}{2})\)
Set \(k_4 = hf(t_n + h, y_n + k_3)\)
Set \(y_{n+1} = y_n + \frac{1}{6}(k_1 + 2k_2 + 2k_3 + k_4)\)