pycvodes


Namepycvodes JSON
Version 0.14.5 PyPI version JSON
download
home_pagehttps://github.com/bjodah/pycvodes
SummaryPython binding for cvodes from the sundials library.
upload_time2024-04-21 08:31:43
maintainerNone
docs_urlhttps://pythonhosted.org/pycvodes/
authorBjoern I. Dahlgren
requires_pythonNone
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            pycvodes
========

.. image:: http://hera.physchem.kth.se:9090/api/badges/bjodah/pycvodes/status.svg
   :target: http://hera.physchem.kth.se:9090/bjodah/pycvodes
   :alt: Build status on private Drone server
.. image:: https://circleci.com/gh/bjodah/pycvodes.svg?style=svg
   :target: https://circleci.com/gh/bjodah/pycvodes
   :alt: Build status on CircleCI
.. image:: https://secure.travis-ci.org/bjodah/pycvodes.svg?branch=master
   :target: http://travis-ci.org/bjodah/pycvodes
   :alt: Build status on Travis-CI
.. image:: https://img.shields.io/pypi/v/pycvodes.svg
   :target: https://pypi.python.org/pypi/pycvodes
   :alt: PyPI version
.. image:: https://img.shields.io/pypi/l/pycvodes.svg
   :target: https://github.com/bjodah/pycvodes/blob/master/LICENSE
   :alt: License
.. image:: https://zenodo.org/badge/43224425.svg
   :target: https://zenodo.org/badge/latestdoi/43224425

`pycvodes <https://github.com/bjodah/pycvodes>`_ provides a
`Python <http://www.python.org>`_ binding to the
`Ordinary Differential Equation <https://en.wikipedia.org/wiki/Ordinary_differential_equation>`_
integration routines from `cvodes <https://computation.llnl.gov/casc/sundials/description/description.html#descr_cvodes>`_ in the
`SUNDIALS suite <https://computation.llnl.gov/casc/sundials/main.html>`_. ``pycvodes`` allows a user to numerically integrate
(systems of) differential equations. Note that routines for sensitivity analysis is not yet exposed in this binding (which makes
the functionality essentially the same as cvode). 

The following multistep methods are available:

- ``bdf``: Backward differentiation formula (of order 1 to 5)
- ``adams``: implicit Adams method (order 1 to 12)

Note that bdf (as an implicit stepper) requires a user supplied
callback for calculating the jacobian.

You may also want to know that you can use ``pycvodes`` from
`pyodesys <https://github.com/bjodah/pyodesys>`_
which can e.g. derive the Jacobian analytically (using SymPy). Pyodesys also provides
plotting functions, C++ code-generation and more.

Documentation
-------------
Autogenerated API documentation for latest stable release is found here:
`<https://bjodah.github.io/pycvodes/latest>`_
(and the development version for the current master branch are found here:
`<http://hera.physchem.kth.se/~pycvodes/branches/master/html>`_).

Installation
------------
Simplest way to install is to use the `conda package manager <http://conda.io/>`_
and install the prebuilt binary from the `Conda Forge <https://conda-forge.org/>`_
channel. We recommend installing into a conda environment with only packages from
Conda Forge::

   $ conda create -n pycvodes -c conda-forge pycvodes pytest
   $ conda activate pycvodes
   (pycvodes)$ python -m pytest --pyargs pycvodes

tests should pass.

Manual installation
~~~~~~~~~~~~~~~~~~~
Binary distribution is available here:
`<https://anaconda.org/bjodah/pycvodes>`_

Source distribution is available here:
`<https://pypi.python.org/pypi/pycvodes>`_

When installing from source you can choose what lapack lib to link against by setting
the environment variable ``PYCVODES_LAPACK``, your choice can later be accessed from python:

.. code:: python

   >>> from pycvodes import config
   >>> config['LAPACK']  # doctest: +SKIP
   'lapack,blas'

If you use ``pip`` to install ``pycvodes``, note that prior to installing pycvodes, you will need
to install sundials (pycvodes>=0.12.0 requires sundials>=5.1.0, pycvodes<0.12 requires sundials<5)
and its development headers, with cvodes & lapack enabled

Examples
--------
The classic van der Pol oscillator (see `examples/van_der_pol.py <examples/van_der_pol.py>`_)

.. code:: python

   >>> import numpy as np
   >>> from pycvodes import integrate_predefined  # also: integrate_adaptive
   >>> mu = 1.0
   >>> def f(t, y, dydt):
   ...     dydt[0] = y[1]
   ...     dydt[1] = -y[0] + mu*y[1]*(1 - y[0]**2)
   ... 
   >>> def j(t, y, Jmat, dfdt=None, fy=None):
   ...     Jmat[0, 0] = 0
   ...     Jmat[0, 1] = 1
   ...     Jmat[1, 0] = -1 - mu*2*y[1]*y[0]
   ...     Jmat[1, 1] = mu*(1 - y[0]**2)
   ...     if dfdt is not None:
   ...         dfdt[:] = 0
   ...
   >>> y0 = [1, 0]; dt0=1e-8; t0=0.0; atol=1e-8; rtol=1e-8
   >>> tout = np.linspace(0, 10.0, 200)
   >>> yout, info = integrate_predefined(f, j, y0, tout, atol, rtol, dt0,
   ...                                   method='bdf')
   >>> import matplotlib.pyplot as plt
   >>> series = plt.plot(tout, yout)
   >>> plt.show()  # doctest: +SKIP


.. image:: https://raw.githubusercontent.com/bjodah/pycvodes/master/examples/van_der_pol.png

For more examples see `examples/ <https://github.com/bjodah/pycvodes/tree/master/examples>`_, and rendered jupyter notebooks here:
`<http://hera.physchem.kth.se/~pycvodes/branches/master/examples>`_


License
-------
The source code is Open Source and is released under the simplified 2-clause BSD license. See `LICENSE <LICENSE>`_ for further details.

Contributors are welcome to suggest improvements at https://github.com/bjodah/pycvodes

Author
------
Björn I. Dahlgren, contact:

- gmail address: bjodah

See file `AUTHORS <AUTHORS>`_ in root for a list of all authors.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bjodah/pycvodes",
    "name": "pycvodes",
    "maintainer": null,
    "docs_url": "https://pythonhosted.org/pycvodes/",
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Bjoern I. Dahlgren",
    "author_email": "bjodah@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/0d/67/d6d59079bc1bf61cc409e6988879e947190dbfe7575eb70b61a651c5dd33/pycvodes-0.14.5.tar.gz",
    "platform": null,
    "description": "pycvodes\n========\n\n.. image:: http://hera.physchem.kth.se:9090/api/badges/bjodah/pycvodes/status.svg\n   :target: http://hera.physchem.kth.se:9090/bjodah/pycvodes\n   :alt: Build status on private Drone server\n.. image:: https://circleci.com/gh/bjodah/pycvodes.svg?style=svg\n   :target: https://circleci.com/gh/bjodah/pycvodes\n   :alt: Build status on CircleCI\n.. image:: https://secure.travis-ci.org/bjodah/pycvodes.svg?branch=master\n   :target: http://travis-ci.org/bjodah/pycvodes\n   :alt: Build status on Travis-CI\n.. image:: https://img.shields.io/pypi/v/pycvodes.svg\n   :target: https://pypi.python.org/pypi/pycvodes\n   :alt: PyPI version\n.. image:: https://img.shields.io/pypi/l/pycvodes.svg\n   :target: https://github.com/bjodah/pycvodes/blob/master/LICENSE\n   :alt: License\n.. image:: https://zenodo.org/badge/43224425.svg\n   :target: https://zenodo.org/badge/latestdoi/43224425\n\n`pycvodes <https://github.com/bjodah/pycvodes>`_ provides a\n`Python <http://www.python.org>`_ binding to the\n`Ordinary Differential Equation <https://en.wikipedia.org/wiki/Ordinary_differential_equation>`_\nintegration routines from `cvodes <https://computation.llnl.gov/casc/sundials/description/description.html#descr_cvodes>`_ in the\n`SUNDIALS suite <https://computation.llnl.gov/casc/sundials/main.html>`_. ``pycvodes`` allows a user to numerically integrate\n(systems of) differential equations. Note that routines for sensitivity analysis is not yet exposed in this binding (which makes\nthe functionality essentially the same as cvode). \n\nThe following multistep methods are available:\n\n- ``bdf``: Backward differentiation formula (of order 1 to 5)\n- ``adams``: implicit Adams method (order 1 to 12)\n\nNote that bdf (as an implicit stepper) requires a user supplied\ncallback for calculating the jacobian.\n\nYou may also want to know that you can use ``pycvodes`` from\n`pyodesys <https://github.com/bjodah/pyodesys>`_\nwhich can e.g. derive the Jacobian analytically (using SymPy). Pyodesys also provides\nplotting functions, C++ code-generation and more.\n\nDocumentation\n-------------\nAutogenerated API documentation for latest stable release is found here:\n`<https://bjodah.github.io/pycvodes/latest>`_\n(and the development version for the current master branch are found here:\n`<http://hera.physchem.kth.se/~pycvodes/branches/master/html>`_).\n\nInstallation\n------------\nSimplest way to install is to use the `conda package manager <http://conda.io/>`_\nand install the prebuilt binary from the `Conda Forge <https://conda-forge.org/>`_\nchannel. We recommend installing into a conda environment with only packages from\nConda Forge::\n\n   $ conda create -n pycvodes -c conda-forge pycvodes pytest\n   $ conda activate pycvodes\n   (pycvodes)$ python -m pytest --pyargs pycvodes\n\ntests should pass.\n\nManual installation\n~~~~~~~~~~~~~~~~~~~\nBinary distribution is available here:\n`<https://anaconda.org/bjodah/pycvodes>`_\n\nSource distribution is available here:\n`<https://pypi.python.org/pypi/pycvodes>`_\n\nWhen installing from source you can choose what lapack lib to link against by setting\nthe environment variable ``PYCVODES_LAPACK``, your choice can later be accessed from python:\n\n.. code:: python\n\n   >>> from pycvodes import config\n   >>> config['LAPACK']  # doctest: +SKIP\n   'lapack,blas'\n\nIf you use ``pip`` to install ``pycvodes``, note that prior to installing pycvodes, you will need\nto install sundials (pycvodes>=0.12.0 requires sundials>=5.1.0, pycvodes<0.12 requires sundials<5)\nand its development headers, with cvodes & lapack enabled\n\nExamples\n--------\nThe classic van der Pol oscillator (see `examples/van_der_pol.py <examples/van_der_pol.py>`_)\n\n.. code:: python\n\n   >>> import numpy as np\n   >>> from pycvodes import integrate_predefined  # also: integrate_adaptive\n   >>> mu = 1.0\n   >>> def f(t, y, dydt):\n   ...     dydt[0] = y[1]\n   ...     dydt[1] = -y[0] + mu*y[1]*(1 - y[0]**2)\n   ... \n   >>> def j(t, y, Jmat, dfdt=None, fy=None):\n   ...     Jmat[0, 0] = 0\n   ...     Jmat[0, 1] = 1\n   ...     Jmat[1, 0] = -1 - mu*2*y[1]*y[0]\n   ...     Jmat[1, 1] = mu*(1 - y[0]**2)\n   ...     if dfdt is not None:\n   ...         dfdt[:] = 0\n   ...\n   >>> y0 = [1, 0]; dt0=1e-8; t0=0.0; atol=1e-8; rtol=1e-8\n   >>> tout = np.linspace(0, 10.0, 200)\n   >>> yout, info = integrate_predefined(f, j, y0, tout, atol, rtol, dt0,\n   ...                                   method='bdf')\n   >>> import matplotlib.pyplot as plt\n   >>> series = plt.plot(tout, yout)\n   >>> plt.show()  # doctest: +SKIP\n\n\n.. image:: https://raw.githubusercontent.com/bjodah/pycvodes/master/examples/van_der_pol.png\n\nFor more examples see `examples/ <https://github.com/bjodah/pycvodes/tree/master/examples>`_, and rendered jupyter notebooks here:\n`<http://hera.physchem.kth.se/~pycvodes/branches/master/examples>`_\n\n\nLicense\n-------\nThe source code is Open Source and is released under the simplified 2-clause BSD license. See `LICENSE <LICENSE>`_ for further details.\n\nContributors are welcome to suggest improvements at https://github.com/bjodah/pycvodes\n\nAuthor\n------\nBj\u00f6rn I. Dahlgren, contact:\n\n- gmail address: bjodah\n\nSee file `AUTHORS <AUTHORS>`_ in root for a list of all authors.\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Python binding for cvodes from the sundials library.",
    "version": "0.14.5",
    "project_urls": {
        "Homepage": "https://github.com/bjodah/pycvodes"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0d67d6d59079bc1bf61cc409e6988879e947190dbfe7575eb70b61a651c5dd33",
                "md5": "a59a255810b64440aa200c5309a92a00",
                "sha256": "a365534e2d9280011bb2faa804da8bc3eb137e5042a3bce75ebd65019d674a02"
            },
            "downloads": -1,
            "filename": "pycvodes-0.14.5.tar.gz",
            "has_sig": false,
            "md5_digest": "a59a255810b64440aa200c5309a92a00",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 336255,
            "upload_time": "2024-04-21T08:31:43",
            "upload_time_iso_8601": "2024-04-21T08:31:43.805152Z",
            "url": "https://files.pythonhosted.org/packages/0d/67/d6d59079bc1bf61cc409e6988879e947190dbfe7575eb70b61a651c5dd33/pycvodes-0.14.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-21 08:31:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bjodah",
    "github_project": "pycvodes",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "circle": true,
    "lcname": "pycvodes"
}
        
Elapsed time: 0.24027s