{ "info": { "author": "Matthew J. Aburn", "author_email": "mattja6@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Science/Research", "License :: OSI Approved :: GNU General Public License (GPL)", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Scientific/Engineering" ], "description": "sdeint\n======\n| Numerical integration of Ito or Stratonovich SDEs.\n\nOverview\n--------\nsdeint is a collection of numerical algorithms for integrating Ito and Stratonovich stochastic ordinary differential equations (SODEs). It has simple functions that can be used in a similar way to ``scipy.integrate.odeint()`` or MATLAB's ``ode45``.\n\nThere already exist some python and MATLAB packages providing Euler-Maruyama and Milstein algorithms, and a couple of others. So why am I bothering to make another package?\n\nIt is because there has been 25 years of further research with better methods but for some reason I can't find any open source reference implementations. Not even for those methods published by Kloeden and Platen way back in 1992. So I will aim to gradually add some improved methods here.\n\nThis is prototype code in python, so not aiming for speed. Later can always rewrite these with loops in C when speed is needed.\n\nWarning: this is an early pre-release. Wait for version 1.0. Bug reports are very welcome!\n\nfunctions\n---------\n| ``itoint(f, G, y0, tspan)`` for Ito equation dy = f(y,t)dt + G(y,t)dW\n| ``stratint(f, G, y0, tspan)`` for Stratonovich equation dy = f(y,t)dt + G(y,t)\u2218dW\n\nThese work with scalar or vector equations. They will choose an algorithm for you. Or you can use a specific algorithm directly:\n\nspecific algorithms:\n--------------------\n| ``itoEuler(f, G, y0, tspan)``: the Euler-Maruyama algorithm for Ito equations.\n| ``stratHeun(f, G, y0, tspan)``: the Stratonovich Heun algorithm for Stratonovich equations.\n| ``itoSRI2(f, G, y0, tspan)``: the R\u00f6\u00dfler2010 order 1.0 strong Stochastic Runge-Kutta algorithm SRI2 for Ito equations.\n| ``itoSRI2(f, [g1,...,gm], y0, tspan)``: as above, with G matrix given as a separate function for each column (gives speedup for large m or complicated G).\n| ``stratSRS2(f, G, y0, tspan)``: the R\u00f6\u00dfler2010 order 1.0 strong Stochastic Runge-Kutta algorithm SRS2 for Stratonovich equations.\n| ``stratSRS2(f, [g1,...,gm], y0, tspan)``: as above, with G matrix given as a separate function for each column (gives speedup for large m or complicated G).\n| ``stratKP2iS(f, G, y0, tspan)``: the Kloeden and Platen two-step implicit order 1.0 strong algorithm for Stratonovich equations.\n| For more information and advanced options see the documentation for each function.\n\nutility functions:\n~~~~~~~~~~~~~~~~~~\n| ``deltaW(N, m, h)``: Generate increments of m independent Wiener processes for each of N time intervals of length h.\n\n| Repeated integrals by the method of Kloeden, Platen and Wright (1992):\n| ``Ikpw(dW, h, n=5)``: Approximate repeated Ito integrals.\n| ``Jkpw(dW, h, n=5)``: Approximate repeated Stratonovich integrals.\n\n| Repeated integrals by the method of Wiktorsson (2001):\n| ``Iwik(dW, h, n=5)``: Approximate repeated Ito integrals.\n| ``Jwik(dW, h, n=5)``: Approximate repeated Stratonovich integrals.\n\nExamples:\n---------\n| Integrate the one-dimensional Ito equation |_| |eqn1|\n| with initial condition ``x0 = 0.1``\n\n.. |eqn1| image:: https://cloud.githubusercontent.com/assets/7663625/12638687/f984ae7c-c5ea-11e5-9b99-ac173d7dfe4c.png\n :alt: dx = -(a + x*b**2)*(1 - x**2)dt + b*(1 - x**2)dW\n.. code-block::\n\n import numpy as np\n import sdeint\n\n a = 1.0\n b = 0.8\n tspan = np.linspace(0.0, 5.0, 5001)\n x0 = 0.1\n\n def f(x, t):\n return -(a + x*b**2)*(1 - x**2)\n\n def g(x, t):\n return b*(1 - x**2)\n\n result = sdeint.itoint(f, g, x0, tspan)\n\n| Integrate the two-dimensional vector Ito equation |_| |eqn2|\n| where ``x = (x1, x2)``, |_| ``dW = (dW1, dW2)`` and with initial condition ``x0 = (3.0, 3.0)``\n\n.. |eqn2| image:: https://cloud.githubusercontent.com/assets/7663625/12638691/012a861a-c5eb-11e5-805d-d704eaff00dd.png\n :alt: dx = A.x dt + B.dW\n.. code-block::\n\n import numpy as np\n import sdeint\n\n A = np.array([[-0.5, -2.0],\n [ 2.0, -1.0]])\n\n B = np.diag([0.5, 0.5]) # diagonal, so independent driving Wiener processes\n\n tspan = np.linspace(0.0, 10.0, 10001)\n x0 = np.array([3.0, 3.0])\n\n def f(x, t):\n return A.dot(x)\n\n def G(x, t):\n return B\n\n result = sdeint.itoint(f, G, x0, tspan)\n\nReferences for these algorithms:\n--------------------------------\n\n| ``itoEuler``:\n| G. Maruyama (1955) Continuous Markov processes and stochastic equations\n| ``stratHeun``:\n| W. Rumelin (1982) Numerical Treatment of Stochastic Differential Equations\n| R. Mannella (2002) Integration of Stochastic Differential Equations on a Computer\n| K. Burrage, P. M. Burrage and T. Tian (2004) Numerical methods for strong solutions of stochastic differential equations: an overview\n| ``itoSRI2, stratSRS2``:\n| A. R\u00f6\u00dfler (2010) Runge-Kutta Methods for the Strong Approximation of Solutions of Stochastic Differential Equations\n| ``stratKP2iS``:\n| P. Kloeden and E. Platen (1999) Numerical Solution of Stochastic Differential Equations, revised and updated 3rd printing\n| ``Ikpw, Jkpw``:\n| P. Kloeden, E. Platen and I. Wright (1992) The approximation of multiple stochastic integrals\n| ``Iwik, Jwik``:\n| M. Wiktorsson (2001) Joint Characteristic Function and Simultaneous Simulation of Iterated Ito Integrals for Multiple Independent Brownian Motions\n\nTODO\n----\n- Rewrite ``Iwik()`` and ``Jwik()`` so they don't waste so much memory.\n\n- Fix ``stratKP2iS()``. In the unit tests it is currently less accurate than ``itoEuler()`` and this is likely due to a bug.\n\n- Implement the Ito version of the Kloeden and Platen two-step implicit alogrithm.\n\n- Add more strong stochastic Runge-Kutta algorithms. Perhaps starting with\n Burrage and Burrage (1996)\n\n- Currently prioritizing those algorithms that work for very general d-dimensional systems with arbitrary noise coefficient matrix, and which are derivative free. Eventually will add special case algorithms that give a speed increase for systems with certain symmetries. That is, 1-dimensional systems, systems with scalar noise, diagonal noise or commutative noise, etc. The idea is that ``itoint()`` and ``stratint()`` will detect these situations and dispatch to the most suitable algorithm.\n\n- Eventually implement the main loops in C for speed.\n\n- Some time in the dim future, implement support for stochastic delay differential equations (SDDEs).\n\nSee also:\n---------\n\n``nsim``: Framework that uses this ``sdeint`` library to enable massive parallel simulations of SDE systems (using multiple CPUs or a cluster) and provides some tools to analyze the resulting timeseries. https://github.com/mattja/nsim\n\n.. |_| unicode:: 0xa0", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/mattja/sdeint/", "keywords": "stochastic,differential equations,SDE,SODE", "license": "GPLv3+", "maintainer": null, "maintainer_email": null, "name": "sdeint", "package_url": "https://pypi.org/project/sdeint/", "platform": "any", "project_url": "https://pypi.org/project/sdeint/", "project_urls": { "Homepage": "http://github.com/mattja/sdeint/" }, "release_url": "https://pypi.org/project/sdeint/0.2.1/", "requires_dist": null, "requires_python": null, "summary": "Numerical integration of stochastic differential equations (SDE)", "version": "0.2.1" }, "last_serial": 2734989, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "edae5fb2b589173ef54c196112241596", "sha256": "29b700b54c0c7b0833f9d2dc6188c56039a5f8dec00894240810dd689f51ccd1" }, "downloads": -1, "filename": "sdeint-0.2.0.tar.gz", "has_sig": false, "md5_digest": "edae5fb2b589173ef54c196112241596", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 38930, "upload_time": "2015-10-30T01:34:57", "url": "https://files.pythonhosted.org/packages/cf/f0/bea37bb0c162763a2bb51556d3229a8dc161e75e7e8c0f01de32e9044038/sdeint-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "7f6792af3b92662cf398e9210e586f13", "sha256": "eb34d28ca2d9cd48ac1b5dcfc80c49536f045aaa93e07146bace059fa8c1c546" }, "downloads": -1, "filename": "sdeint-0.2.1.tar.gz", "has_sig": false, "md5_digest": "7f6792af3b92662cf398e9210e586f13", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 40098, "upload_time": "2017-03-28T01:59:12", "url": "https://files.pythonhosted.org/packages/3d/26/69946549a57a04ff033780129f3121530565998c017f4f4f06530c2a5b88/sdeint-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7f6792af3b92662cf398e9210e586f13", "sha256": "eb34d28ca2d9cd48ac1b5dcfc80c49536f045aaa93e07146bace059fa8c1c546" }, "downloads": -1, "filename": "sdeint-0.2.1.tar.gz", "has_sig": false, "md5_digest": "7f6792af3b92662cf398e9210e586f13", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 40098, "upload_time": "2017-03-28T01:59:12", "url": "https://files.pythonhosted.org/packages/3d/26/69946549a57a04ff033780129f3121530565998c017f4f4f06530c2a5b88/sdeint-0.2.1.tar.gz" } ] }