CraigF
CraigF

Reputation: 416

Is there a python module to solve/integrate a system of stochastic differential equations?

I have a system of stochastic differential equations that I would like to solve. I was hoping that this issue was already address. I am a bit concerned about constructing my own solver because I fear my solver would be too slow, and there could be the issues with numerical stability.

Is there a python module for such problems?

If not, is there a standard approach for solving such systems.

Upvotes: 7

Views: 4120

Answers (3)

Ruvi Lecamwasam
Ruvi Lecamwasam

Reputation: 101

The package diffeqpy brings Julia's DifferentialEquations.jl to Python. This is capable of doing a lot of things, including stochastic differential equations.

Upvotes: 0

jman
jman

Reputation: 703

The link in the accepted answer no longer functions. There is also sdeint:

https://pypi.org/project/sdeint/#description

Which was released a few years after the accepted answer and looks to be in semi-active development. A second example in the documentation has a system of SDE with constant coefficients. I am unsure if they have support for more complex SDE systems.

Upvotes: 1

Kabie
Kabie

Reputation: 10663

There is one: http://diffusion.cgu.edu.tw/ftp/sde/

Example from the site:

""" add required Python packages """
from pysde import *
from sympy import *
""" Variables acclaimed """
x,dx=symbols('x dx')
r,G,e,d=symbols('r G epsilon delta')
""" Solve Kolmogorov Forward Equation """
l=sde.KolmogorovFE_Spdf(r*(G-x),e*x*(1-x),0,1)
sol=l.subs({e:r*d})

pprint(sol)

Upvotes: 8

Related Questions