sde_implicit_euler_step

sde_implicit_euler_step#

class braintools.quad.sde_implicit_euler_step(df, dg, y, t, *args, max_iter=2, **kwargs)#

Implicit (drift-implicit) Euler–Maruyama step solved with Newton’s method.

Solves y_{n+1} = y_n + f(y_{n+1}, t_{n+1}) dt + g(y_n, t_n) dW for y_{n+1} with Newton iterations started from y_n + g(y_n, t_n) dW.

Parameters:
  • df (Callable[..., PyTree]) – Drift function f(y, t, *args).

  • dg (Callable[..., PyTree]) – Diffusion function g(y, t, *args).

  • y (PyTree) – Current state.

  • t (float | Quantity) – Current time.

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

  • max_iter (int) – Number of Newton iterations for the implicit drift. One iteration is exact when f is linear in y.

Returns:

The updated state y_{n+1}.

Return type:

PyTree

Notes

  • The implicit drift equation is solved with Newton’s method, as in the IMEX steppers: with a dense Jacobian for states of up to 256 elements and matrix-free GMRES on Jacobian-vector products for larger states. The step is stable for stiff drifts of any |∂f/∂y| dt.

  • Diffusion is treated explicitly with g(y_n, t_n) dW.