braincell.quad.euler_step#
- braincell.quad.euler_step(target, *args)[source]#
Advance one step with the explicit (forward) Euler method.
Forward Euler is the simplest explicit Runge-Kutta scheme. For a system
\[\frac{dy}{dt} = f(t, y),\]the update reads
\[y_{n+1} = y_n + \Delta t \, f(t_n, y_n).\]The local truncation error is \(O(\Delta t^2)\) and the global error is \(O(\Delta t)\) (first-order accurate). The method is only conditionally stable; for stiff problems prefer
backward_euler_step(),exp_euler_step(), or one of the implicit Runge-Kutta variants.- Parameters:
target (
DiffEqModule) – Differential-equation module to advance. Itspre_integral(),compute_derivative(), andpost_integral()hooks are called by the underlying Runge-Kutta driver.*args – Extra positional arguments forwarded to
target’s pre/derivative/post hooks (typically the input currents for this step).
- Returns:
The state held inside target (every
DiffEqState) is updated in place.- Return type:
None
See also
midpoint_step,rk2_step,heun2_steprk4_stepClassical fourth-order Runge-Kutta.
backward_euler_stepImplicit (backward) Euler counterpart.
Notes
The corresponding Butcher tableau (stored as
euler_tableau) is\[\begin{split}\begin{array}{c|c} 0 & 0 \\ \hline & 1 \end{array}.\end{split}\]The current time
tand step sizedtare read from the activebrainstate.environcontext.Examples
>>> import brainstate >>> import brainunit as u >>> from braincell.quad import euler_step >>> with brainstate.environ.context(t=0. * u.ms, dt=0.01 * u.ms): ... euler_step(my_neuron)