Scipy-based Delay Differential Equations solver
Project description
ddeint
Scipy-based delay differential equation (DDE) solver. See the docstrings and examples for more infos.
Examples
from pylab import cos, linspace, subplots
from ddeint import ddeint
def model(Y, t):
return -Y(t - 3 * cos(Y(t)) ** 2)
def values_before_zero(t):
return 1
tt = linspace(0, 30, 2000)
yy = ddeint(model, values_before_zero, tt)
fig, ax = subplots(1, figsize=(4, 4))
ax.plot(tt, yy)
ax.figure.savefig("variable_delay.jpeg")
from pylab import array, linspace, subplots
from ddeint import ddeint
def model(Y, t, d):
x, y = Y(t)
xd, yd = Y(t - d)
return array([0.5 * x * (1 - yd), -0.5 * y * (1 - xd)])
g = lambda t: array([1, 2])
tt = linspace(2, 30, 20000)
fig, ax = subplots(1, figsize=(4, 4))
for d in [0, 0.2]:
print("Computing for d=%.02f" % d)
yy = ddeint(model, g, tt, fargs=(d,))
# WE PLOT X AGAINST Y
ax.plot(yy[:, 0], yy[:, 1], lw=2, label="delay = %.01f" % d)
ax.figure.savefig("lotka.jpeg")
Licence
Public domain. Everyone is welcome to contribute !
##Installation
ddeint can be installed by unzipping the source code in one directory and using this command: ::
(sudo) python setup.py install
You can also install it directly from the Python Package Index with this command: ::
(sudo) pip install ddeint
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
ddeint-0.2.tar.gz
(6.6 kB
view details)
File details
Details for the file ddeint-0.2.tar.gz
.
File metadata
- Download URL: ddeint-0.2.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4929af5f1d1024a59db5d5c36a3b797b1554a451533e3767fbebefe7604f2b59 |
|
MD5 | eb37627c5fa25237eb91bf478eff30ad |
|
BLAKE2b-256 | c6d8f5816e6a024830ae5be896ec5c7be7745d6a96740e1da7a89106a2aea273 |