ddeint


Nameddeint JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryScipy-based Delay Differential Equations solver
upload_time2024-08-27 03:20:46
maintainerNone
docs_urlNone
authorZulko
requires_python>=3.8
licenseCCO
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ddeint

[![PyPI](https://img.shields.io/pypi/v/ddeint.svg)](https://pypi.org/project/ddeint/)
[![Tests](https://github.com/zulko/ddeint/actions/workflows/test.yml/badge.svg)](https://github.com/zulko/ddeint/actions/workflows/test.yml)
[![Changelog](https://img.shields.io/github/v/release/zulko/ddeint?include_prereleases&label=changelog)](https://github.com/zulko/ddeint/releases)


Scipy-based delay differential equation (DDE) solver. See the docstrings and examples for more infos.

## Examples


```python
from pylab import cos, linspace, subplots
from ddeint import ddeint

# We solve the following system:
# Y(t) = 1 for t < 0
# dY/dt = -Y(t - 3cos(t)**2) for t > 0

def values_before_zero(t):
    return 1

def model(Y, t):
    return -Y(t - 3 * cos(Y(t)) ** 2)

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")
```

![screenshot](https://github.com/Zulko/ddeint/raw/master/examples/variable_delay.jpeg)

```python
from pylab import array, linspace, subplots
from ddeint import ddeint

# We solve the following system:
# X(t) = 1 (t < 0)
# Y(t) = 2 (t < 0)
# dX/dt = X * (1 - Y(t-d)) / 2
# dY/dt = -Y * (1 - X(t-d)) / 2


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")
```

![screenshot](https://github.com/Zulko/ddeint/raw/master/examples/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 

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ddeint",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Zulko",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/ce/06/094f64e440a9d9f14ebf9d1c3fdd9637b2bbc0709fe3cc2196bcd6f78ad9/ddeint-0.3.0.tar.gz",
    "platform": null,
    "description": "# ddeint\n\n[![PyPI](https://img.shields.io/pypi/v/ddeint.svg)](https://pypi.org/project/ddeint/)\n[![Tests](https://github.com/zulko/ddeint/actions/workflows/test.yml/badge.svg)](https://github.com/zulko/ddeint/actions/workflows/test.yml)\n[![Changelog](https://img.shields.io/github/v/release/zulko/ddeint?include_prereleases&label=changelog)](https://github.com/zulko/ddeint/releases)\n\n\nScipy-based delay differential equation (DDE) solver. See the docstrings and examples for more infos.\n\n## Examples\n\n\n```python\nfrom pylab import cos, linspace, subplots\nfrom ddeint import ddeint\n\n# We solve the following system:\n# Y(t) = 1 for t < 0\n# dY/dt = -Y(t - 3cos(t)**2) for t > 0\n\ndef values_before_zero(t):\n    return 1\n\ndef model(Y, t):\n    return -Y(t - 3 * cos(Y(t)) ** 2)\n\ntt = linspace(0, 30, 2000)\nyy = ddeint(model, values_before_zero, tt)\n\nfig, ax = subplots(1, figsize=(4, 4))\nax.plot(tt, yy)\nax.figure.savefig(\"variable_delay.jpeg\")\n```\n\n![screenshot](https://github.com/Zulko/ddeint/raw/master/examples/variable_delay.jpeg)\n\n```python\nfrom pylab import array, linspace, subplots\nfrom ddeint import ddeint\n\n# We solve the following system:\n# X(t) = 1 (t < 0)\n# Y(t) = 2 (t < 0)\n# dX/dt = X * (1 - Y(t-d)) / 2\n# dY/dt = -Y * (1 - X(t-d)) / 2\n\n\ndef model(Y, t, d):\n    x, y = Y(t)\n    xd, yd = Y(t - d)\n    return array([0.5 * x * (1 - yd), -0.5 * y * (1 - xd)])\n\n\ng = lambda t: array([1, 2])\ntt = linspace(2, 30, 20000)\n\nfig, ax = subplots(1, figsize=(4, 4))\n\nfor d in [0, 0.2]:\n    print(\"Computing for d=%.02f\" % d)\n    yy = ddeint(model, g, tt, fargs=(d,))\n    # WE PLOT X AGAINST Y\n    ax.plot(yy[:, 0], yy[:, 1], lw=2, label=\"delay = %.01f\" % d)\n\nax.figure.savefig(\"lotka.jpeg\")\n```\n\n![screenshot](https://github.com/Zulko/ddeint/raw/master/examples/lotka.jpeg)\n\n## Licence\n\n\nPublic domain. Everyone is welcome to contribute !\n\n## Installation\n\nddeint can be installed by unzipping the source code in one directory and using this command: ::\n\n    (sudo) python setup.py install\n\nYou can also install it directly from the Python Package Index with this command: ::\n\n    (sudo) pip install ddeint \n",
    "bugtrack_url": null,
    "license": "CCO",
    "summary": "Scipy-based Delay Differential Equations solver",
    "version": "0.3.0",
    "project_urls": {
        "CI": "https://github.com/zulko/ddeint/actions",
        "Changelog": "https://github.com/zulko/ddeint/releases",
        "Homepage": "https://github.com/zulko/ddeint",
        "Issues": "https://github.com/zulko/ddeint/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1def6303681fdc6cf3b72d0b158ea9b18480a1ebc3fab16605a243112725fa68",
                "md5": "74d25604a31821a3850626f84e93c994",
                "sha256": "44c5cbb447069539ae5d03b245738724da6575bb0388d99261dabc0f8e162841"
            },
            "downloads": -1,
            "filename": "ddeint-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "74d25604a31821a3850626f84e93c994",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6814,
            "upload_time": "2024-08-27T03:20:45",
            "upload_time_iso_8601": "2024-08-27T03:20:45.255891Z",
            "url": "https://files.pythonhosted.org/packages/1d/ef/6303681fdc6cf3b72d0b158ea9b18480a1ebc3fab16605a243112725fa68/ddeint-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ce06094f64e440a9d9f14ebf9d1c3fdd9637b2bbc0709fe3cc2196bcd6f78ad9",
                "md5": "1796df8caad35de1f45a59f1071b029b",
                "sha256": "51dd96545e06750037b25329880896d9408940a67a6228d0a07a82c38e33710f"
            },
            "downloads": -1,
            "filename": "ddeint-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1796df8caad35de1f45a59f1071b029b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6859,
            "upload_time": "2024-08-27T03:20:46",
            "upload_time_iso_8601": "2024-08-27T03:20:46.388515Z",
            "url": "https://files.pythonhosted.org/packages/ce/06/094f64e440a9d9f14ebf9d1c3fdd9637b2bbc0709fe3cc2196bcd6f78ad9/ddeint-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-27 03:20:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zulko",
    "github_project": "ddeint",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "ddeint"
}
        
Elapsed time: 0.32696s