sde_euler_step

Contents

sde_euler_step#

class braintools.quad.sde_euler_step(df, dg, y, t, *args, sde_type='ito', **kwargs)#

One Euler–Maruyama step for Ito SDEs.

This integrates an Ito SDE of the form

\[dy = f(y, t)\,dt + g(y, t)\,dW,\]

where f is the drift and g is the diffusion, using y_{n+1} = y_n + f(y_n, t_n) dt + g(y_n, t_n) dW_n with dW_n ~ Normal(0, dt) applied per PyTree leaf.

Parameters:
  • df (Callable[[PyTree, float | Quantity, ...], PyTree]) – Drift function f(y, t, *args) returning a PyTree matching y.

  • dg (Callable[[PyTree, float | Quantity, ...], PyTree]) – Diffusion function g(y, t, *args) returning a PyTree matching y.

  • y (PyTree) – Current state.

  • t (float | Quantity) – Current time (scalar or array broadcastable with y leaves).

  • *args – Extra arguments passed to df and dg.

  • sde_type (str) – Interpretation of the SDE. Only 'ito' is supported, by default ‘ito’.

Returns:

The updated state y_{n+1} with the same tree structure as y.

Return type:

PyTree

See also

sde_milstein_step

Milstein scheme (strong order 1.0).

sde_expeuler_step

Exponential Euler with linearized drift.

Notes

  • Strong order 0.5, weak order 1.0.

  • Uses dt = brainstate.environ.get_dt() and Gaussian noise scaled by sqrt(dt) via brainstate.random.randn_like for each leaf of y.