braincell.quad.ralston3_step#
- braincell.quad.ralston3_step(target, *args)[source]#
Advance one step with Ralston’s third-order Runge-Kutta method.
Ralston’s three-stage third-order RK method is the third-order explicit Runge-Kutta scheme that minimises the leading-order truncation error coefficient:
\[\begin{split}k_1 &= f(t_n, y_n), \\ k_2 &= f\!\left(t_n + \tfrac{1}{2}\Delta t,\ y_n + \tfrac{1}{2}\Delta t \, k_1\right), \\ k_3 &= f\!\left(t_n + \tfrac{3}{4}\Delta t,\ y_n + \tfrac{3}{4}\Delta t \, k_2\right), \\ y_{n+1} &= y_n + \Delta t \left(\tfrac{2}{9} k_1 + \tfrac{1}{3} k_2 + \tfrac{4}{9} k_3\right).\end{split}\]Local truncation error is \(O(\Delta t^4)\); global error is \(O(\Delta t^3)\).
- Parameters:
target (
DiffEqModule) – Differential-equation module to advance.*args – Extra positional arguments forwarded to
target’s integration hooks.
- Returns:
Updates target’s state in place.
- Return type:
None
See also
Notes
Butcher tableau (
ralston3_tableau):\[\begin{split}\begin{array}{c|ccc} 0 & 0 & 0 & 0 \\ \tfrac{1}{2} & \tfrac{1}{2} & 0 & 0 \\ \tfrac{3}{4} & 0 & \tfrac{3}{4} & 0 \\ \hline & \tfrac{2}{9} & \tfrac{1}{3} & \tfrac{4}{9} \end{array}\end{split}\]References
Examples
>>> import brainstate >>> import brainunit as u >>> from braincell.quad import ralston3_step >>> with brainstate.environ.context(t=0. * u.ms, dt=0.01 * u.ms): ... ralston3_step(my_neuron)