#sde_solve ###a tiny library for numerically solving stochastic differential equations
##Installation
- Clone this repo
- enter the resulting directory
sudo python setup.py install
orpython setup.py install --user
if you don't have superuser privileges.
##Use The purpose of this library is to produce numerical solutions to differential equations of the form:
d_rho = det_f(t,rho) dt + stoc_f(t, rho) dW
using the order-1.5 strong solver for non-autonomous equations from Kloeden and Platen, page 379.
There's only one function in this repo, sde_platen_15
:
sde_platen_15(rho_init, det_f, stoc_f, times, dWs, e_cb)
The input variables are:
rho_init
: an initial value. This can be any object that supports arithmetic methods in principle, but it must be accepted as input bydet_f
andstoc_f
, see below.det_f
: the deterministic contribution to the derivative. This is a function with signaturedet_f(t, rho)
stoc_f
: the stochastic contribution to the derivative. This is a function with signaturestoc_f(t, rho)
.times
: values of time (in arb. units) at which the solution is to be calculated. In principle, can be any type which supports__getitem__
. In practice, NumPy arrays work best. Note: As of the current version,sde_platen_15
assumes this iterable to have a fixed difference.dWs
: iterable of values for the Wiener increment. This is not generated within the function, since it is often convenient for this variable to be in scope wheresde_platen_15
is called.e_cb
: Callback function with signaturee_cb(t, rho, dW)
. This brings the interim values of time, solution and Wiener increment into whatever namespace in whiche_cb
isdef
'd.
##Example Coming soon
##Future Work
- Adaptive timesteps
- Switching the whole thing over to Julia, so I can decide at runtime whether to use an implicit method.