Skip to content

num::rk4

Defined in header <ode/ode.hpp>

template <typename RHS = ode_rhs_fn, typename State = vec<real>>
requires vector_space<State> && std::invocable<RHS &, real, const State &, State &>
basic_rk4_steps<RHS, State> rk4(RHS f, State y0, ode_params p = {});

Lazy classical fourth-order Runge--Kutta trajectory for \(\dot{y} = f(t, y)\).

f has the signature void(real t, const State& y, State& dy), and p supplies t0, tf and dt.