sde_milstein_step

sde_milstein_step#

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

One Milstein step for Ito or Stratonovich SDEs.

This integrates an SDE of the form

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

using the Milstein scheme. In Ito form, the update is

\[y_{n+1} = y_n + f_n dt + g_n dW_n + \tfrac{1}{2} g_n \partial_y g_n (dW_n^2 - dt),\]

while for Stratonovich (sde_type='stra') the last term uses dW_n^2 instead of (dW_n^2 - dt). The directional derivative \partial_y g is approximated here by a finite difference using an intermediate evaluation.

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

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

  • y (PyTree) – Current state.

  • t (float | Quantity) – Current time.

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

  • sde_type (str) – Interpretation of the SDE: Ito or Stratonovich ('stra').

Returns:

The updated state y_{n+1}.

Return type:

PyTree

See also

sde_euler_step

Euler–Maruyama scheme.

sde_expeuler_step

Exponential Euler with linearized drift.

Notes

  • Strong order 1.0 (Ito), offering higher accuracy than Euler–Maruyama.

  • The derivative term is realized via a finite-difference correction using an auxiliary diffusion evaluation at an intermediate state.