Module runge_kutta

Module runge_kutta 

Source
Expand description

Runge-Kutta 4th order method for numerical ODE solving

Implements the classic RK4 method for first-order ODEs: y’ = f(x, y) Formula: k1 = f(x_n, y_n) k2 = f(x_n + h/2, y_n + hk1/2) k3 = f(x_n + h/2, y_n + hk2/2) k4 = f(x_n + h, y_n + hk3) y_{n+1} = y_n + h/6 * (k1 + 2k2 + 2*k3 + k4)

Functions§

rk4_method
Solves a first-order ODE using Runge-Kutta 4th order method
solve_rk4
Solves a first-order ODE using RK4 method with Result type