ode_euler_step

Contents

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 function f(y, t, *args) -> PyTree that computes the time-derivative at (y, t).

  • y (PyTree) – Current state at time t. 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_step

Second-order Runge–Kutta.

ode_rk4_step

Fourth-order Runge–Kutta.

ode_expeuler_step

Exponential Euler step.

Notes

  • First-order accurate with local truncation error \(\mathcal{O}(\Delta t)\).

  • Uses dt = brainstate.environ.get_dt() as the step size.