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
sdepy
integrator.Parameters: - sde : function
Function to be wrapped. Its signature and values should be as expected for the
sde
method of thesdepy.SDE
orsdepy.SDEs
classes.- q : int
Number of equations. If
None
, attempts a test evaluation ofsde
to find out.q=0
indicates a single equation.- sources : set
Stochasticity sources used in the equation. If
None
, attempts a test evaluation ofsde
to find out.- log : bool
Sets the
log
attribute for the wrapping class.- addaxis : bool
Sets the
addaxis
attribute for the wrapping class.
Returns: - A subclass of
sdepy.SDE
orsdepy.SDEs
as appropriate, - and of
sdepy.integrator
, with the givensde
- cast as its
sde
method.
Notes
To prevent a test evaluation of
sde
, explicitly provide the intendedq
andsources
as 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)