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 usesdW_n^2instead of(dW_n^2 - dt). The directional derivative\partial_y gis approximated here by a finite difference using an intermediate evaluation.- Parameters:
df (
Callable[[PyTree,float|Quantity,...],PyTree]) – Drift functionf(y, t, *args).dg (
Callable[[PyTree,float|Quantity,...],PyTree]) – Diffusion functiong(y, t, *args).y (
PyTree) – Current state.t (
float|Quantity) – Current time.*args – Extra arguments forwarded to
dfanddg.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_stepEuler–Maruyama scheme.
sde_expeuler_stepExponential 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.