ode_rk3_step

Contents

ode_rk3_step#

class braintools.quad.ode_rk3_step(f, y, t, *args, **kwargs)#

Third-order Runge–Kutta (RK3) step for ODEs.

A common RK3 scheme uses three stages:

\[\begin{split}k_1 = f(y_n, t_n),\\ k_2 = f\big(y_n + \tfrac{\Delta t}{2}k_1,\ t_n + \tfrac{\Delta t}{2}\big),\\ k_3 = f\big(y_n - \Delta t\,k_1 + 2\Delta t\,k_2,\ t_n + \Delta t\big),\\ y_{n+1} = y_n + \tfrac{\Delta t}{6}(k_1 + 4k_2 + k_3).\end{split}\]
Parameters:
  • f (Callable[[PyTree, float | Quantity, ...], PyTree]) – Right-hand side function f(y, t, *args) -> PyTree.

  • y (PyTree) – Current state at time t.

  • t (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Current time.

  • *args – Additional positional arguments forwarded to f.

Returns:

The updated state after one RK3 step.

Return type:

PyTree

Notes

Third-order accurate with local truncation error \(\mathcal{O}(\Delta t^3)\).