Straightforward numerical integration of ODE systems from SymPy.
Project description
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
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.