ode_euler_step#
- class braintools.quad.ode_euler_step(f, y, t, *args, **kwargs)#
Explicit Euler step for ordinary differential equations.
Implements a single forward Euler step for ODEs of the form
\[\frac{dy}{dt} = f(y, t), \qquad y_{n+1} = y_n + \Delta t\, f(y_n, t_n).\]- Parameters:
f (
Callable[[PyTree,float|Quantity,...],PyTree]) – Right-hand side functionf(y, t, *args) -> PyTreethat computes the time-derivative at(y, t).y (
PyTree) – Current state at timet. Any JAX-compatible pytree.t (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Current time. If a quantity, units may propagate through derivatives.*args – Additional positional arguments forwarded to
f.
- Returns:
The updated state
y_{n+1}after one Euler step.- Return type:
PyTree
See also
ode_rk2_stepSecond-order Runge–Kutta.
ode_rk4_stepFourth-order Runge–Kutta.
ode_expeuler_stepExponential Euler step.
Notes
First-order accurate with local truncation error \(\mathcal{O}(\Delta t)\).
Uses
dt = brainstate.environ.get_dt()as the step size.