sde_heun_step

Contents

sde_heun_step#

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

Stochastic Heun (predictor–corrector) step.

Implements a predictor–corrector scheme. For Stratonovich SDEs, both drift and diffusion are averaged between the predictor and corrector; for Itô SDEs only the drift is averaged while diffusion is evaluated at the start.

Predictor#

y* = y + f(y, t) dt + g(y, t) dW

Corrector#

  • Itô: y_{n+1} = y + 0.5 (f(y, t) + f(y*, t+dt)) dt + g(y, t) dW

  • Stratonovich: y_{n+1} = y + 0.5 (f(y, t) + f(y*, t+dt)) dt + 0.5 (g(y, t) + g(y*, t+dt)) dW

param df:

Drift function f(y, t, *args).

type df:

Callable[[PyTree, float | Quantity, ...], PyTree]

param dg:

Diffusion function g(y, t, *args).

type dg:

Callable[[PyTree, float | Quantity, ...], PyTree]

param y:

Current state.

type y:

PyTree

param t:

Current time.

type t:

float | Quantity

type *args:

param *args:

Extra arguments forwarded to df and dg.

param sde_type:

Interpretation of the SDE.

type sde_type:

str

returns:

The updated state y_{n+1}.

rtype:

PyTree