sde_expeuler_step#
- class braintools.quad.sde_expeuler_step(df, dg, y, t, *args, **kwargs)#
One Exponential Euler step for SDEs with linearized drift.
The drift
fis locally linearized and integrated exactly over one step via the exponential relative function, while the diffusion term fromgis added in Euler form with Gaussian noise scaled bysqrt(dt).As in
ode_expeuler_step(), the linearization uses the column sums of the Jacobian off, which equal its diagonal only for elementwise dynamics. Because the noise is not propagated through the exponential, the stationary variance of a linear (Ornstein–Uhlenbeck) equation is overestimated for largedt:g^2 dt / (1 - exp(-2 θ dt))instead ofg^2 / (2 θ).- Parameters:
df (
Callable[...,PyTree]) – Drift functionf(y, t, *args). Its value and vector–Jacobian product are used internally for the exponential update.dg (
Callable[...,PyTree]) – Diffusion functiong(y, t, *args).y (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Current state. Must have a floating dtype.t (
float|Quantity) – Current time.*args – Extra arguments forwarded to
dfanddg.
- Returns:
The updated state
y_{n+1}with the same structure asy. The Brownian increment is sampled with the shape ofy.- Return type:
PyTree
See also
sde_euler_stepEuler–Maruyama scheme.
sde_milstein_stepMilstein scheme (strong order 1.0).
Notes
Uses
dt = brainstate.environ.get('dt')for the step size.Requires floating dtypes for
y(float16/32/64 or bfloat16).Unit consistency is validated using
brainunit; a mismatch between the drift update and diffusion units raises aValueError.