Expand description
Ordinary differential equation (ODE) solvers from scratch.
Provides Euler’s method, the classical 4th-order Runge–Kutta (RK4), and adaptive step-size control via the Runge–Kutta–Fehlberg (RKF45) method.
Functions§
- euler
- Integrate
dy/dt = f(t, y)fromt0tot1with initial conditiony0using Euler’s method withnsteps. - euler_
step - One step of Euler’s method:
y_{n+1} = y_n + h * f(t_n, y_n). - rk4
- Integrate
dy/dt = f(t, y)fromt0tot1with initial conditiony0using RK4 withnsteps. - rk4_
step - One step of classical 4th-order Runge–Kutta (RK4).
- rk4_
system - RK4 for a system of ODEs:
dy_i/dt = f_i(t, y).y0is the initial state vector; returns the state att1. - rk4_
trajectory - Integrate and return the full trajectory as
Vec<(t, y)>. - rkf45
- Adaptive RK4(5) — Runge–Kutta–Fehlberg — with automatic step-size control.
Integrates
dy/dt = f(t, y)fromt0tot1with initial conditiony0.tolis the desired absolute error per step.