utils.solver.rk4_method
utils.solver.rk4_method(f, t_span, y0, dt, si=None, args=(), post_step=None)Fixed-step 4th-order Runge-Kutta integrator.
Parameters
f : callable-
Derivative function with signature
f(t, y, *args). t_span : tuple of float-
(t0, tf)integration bounds. y0 : array -like-
Initial state vector.
dt : float-
Integration timestep.
si : float or None = None-
Sampling interval — output is saved every
sitime units. Must be an integer multiple ofdt. Defaults todt(every step is saved). args : tuple = ()-
Extra positional arguments forwarded to
f. post_step : callable or None = None-
Optional hook called after each accepted sub-step with signature
post_step(t, y) -> y. The returned array replaces the current state, allowing post-step corrections (e.g. state nudging).
Returns
solution : Solution-
Object with attributes
t(time axis) andy(state trajectory).
Raises
: ValueError-
If
t_spanis invalid,siis not an integer multiple ofdt, ort_spanlength is not an integer multiple ofsi.