ode_rk2_step#
- class braintools.quad.ode_rk2_step(f, y, t, *args, **kwargs)#
Second-order Runge–Kutta (RK2) step for ODEs.
The classical RK2 (Heun/midpoint) method performs two function evaluations:
\[\begin{split}k_1 = f(y_n, t_n),\\ k_2 = f\big(y_n + \Delta t\,k_1,\ t_n + \Delta t\big),\\ y_{n+1} = y_n + \tfrac{\Delta t}{2}\,(k_1 + k_2).\end{split}\]- Parameters:
- Returns:
The updated state after one RK2 step.
- Return type:
PyTree
Notes
Second-order accurate with local truncation error \(\mathcal{O}(\Delta t^2)\).