2.4.5. sdepy.integrate¶
-
sdepy.integrate(sde=None, *, q=None, sources=None, log=False, addaxis=False)[source]¶ Decorator for Ito Stochastic Differential Equation (SDE) integration.
Decorates a function representing the SDE or SDEs into the corresponding
sdepyintegrator.Parameters: - sde : function
Function to be wrapped. Its signature and values should be as expected for the
sdemethod of thesdepy.SDEorsdepy.SDEsclasses.- q : int
Number of equations. If
None, attempts a test evaluation ofsdeto find out.q=0indicates a single equation.- sources : set
Stochasticity sources used in the equation. If
None, attempts a test evaluation ofsdeto find out.- log : bool
Sets the
logattribute for the wrapping class.- addaxis : bool
Sets the
addaxisattribute for the wrapping class.
Returns: - A subclass of
sdepy.SDEorsdepy.SDEsas appropriate, - and of
sdepy.integrator, with the givensde - cast as its
sdemethod.
Notes
To prevent a test evaluation of
sde, explicitly provide the intendedqandsourcesas keyword arguments tointegrate(). The test evaluation is attempted assde()and, upon failure, again assde(1., 1.).Examples
>>> from sdepy import integrate >>> @integrate ... def my_process(t, x, theta=1., k=1., sigma=1.): ... return {'dt': k*(theta - x), 'dw': sigma}
>>> P = my_process(x0=1, sigma=0.5, paths=100*1000, steps=100) >>> x = P(timeline=(0., 0.5, 1.)) >>> x.shape (3, 100000)