ode_expeuler_step#
- class braintools.quad.ode_expeuler_step(f, y, t, *args, **kwargs)#
One-step Exponential Euler method for ODEs with linearized drift.
Examples
>>> def fun(x, t): ... return -x >>> x = 1.0 >>> exp_euler_step(fun, x, 0.)
If the variable ( \(x\) ) has units of ( \([X]\) ), then the drift term ( \(\text{drift_fn}(x)\) ) should have units of ( \([X]/[T]\) ), where ( \([T]\) ) is the unit of time.
If the variable ( x ) has units of ( [X] ), then the diffusion term ( text{diffusion_fn}(x) ) should have units of ( [X]/sqrt{[T]} ).
- Parameters:
f (
Callable[[PyTree,float|Quantity,...],PyTree]) – Drift functionf(y, t, *args)used in the exponential update.y (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Current state. Must have a floating dtype.t (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Current time.*args – Additional positional arguments forwarded to
f.
- Returns:
The updated state
y_{n+1}.- Return type:
PyTree