Skip to main content

Straightforward numerical integration of ODE systems from SymPy.

Project description

Build status PyPI version License

pyodesys provides a straightforward way of numerically integrating systems of ordinary differential equations. It unifies the interface of several libraries. It also provides a convenience class for representing and integrating ODE systems defined by SymPy expressions.

The numerical integration is perfomed using eiher:

Note that implicit steppers which require a user supplied callback for calculating the jacobian is provided automatically by pyodesys.

Documentation

Autogenerated API documentation is found here: https://bjodah.github.com/pyodesys

Installation

Simplest way to install pyodesys and its (optional) dependencies is to use the conda package manager:

$ conda install -c bjodah pyodesys pytest
$ python -m pytest --pyargs pyodesys

Optional requirements not listed in requirements.txt:

  • pygslodeiv2

  • pyodeint

  • pycvodes

Source distribution is available here: https://pypi.python.org/pypi/pyodesys

Example

The classic van der Pol oscillator (see examples/van_der_pol.py)

>>> import sympy as sp
>>> import numpy as np
>>> from pyodesys import SymbolicSys
>>> mu = 1.0
>>> y = sp.symarray('y', 2)
>>> f = [y[1], -y[0] + mu*y[1]*(1 - y[0]**2)]
>>> odesys = SymbolicSys(zip(y, f))
>>> out = odesys.integrate('odeint', 10, [1, 0])  # use pyodeint
>>> import matplotlib.pyplot as plt
>>> plt.plot(out[:, 0], out[:, 1:])  # doctest: +SKIP
https://raw.githubusercontent.com/bjodah/pyodesys/master/examples/van_der_pol.png

License

The source code is Open Source and is released under the simplified 2-clause BSD license. See LICENSE for further details. Contributors are welcome to suggest improvements at https://github.com/bjodah/pyodesys

Author

Björn I. Dahlgren, contact:

  • gmail address: bjodah

  • kth.se address: bda

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyodesys-0.1.2.tar.gz (10.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page