Skip to main content

pykinsol provides a Python interface to KINSOL from the SUNDIALS package suite.

Project description

Build status Build status on CircleCI Build status on Travis-CI PyPI version License coverage

pykinsol provides a Python binding to the Nonlinear system of equation solver algorithms from kinsol in the SUNDIALS suite. pykinsol allows a user to numerically solve (systems of) non-linear equations. Note that not all functionality of KINSOL are currently exposed in the python wrapper. Additional functionality is however easy to add if needed.

You may also want to know that you can use pykinsol from pyneqsys which can e.g. derive the Jacobian analytically for you.

Documentation

Autogenerated API documentation is found here.

Installation

Simplest way to install pykinsol is to use the conda package manager:

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

tests should pass.

Binary distribution is available here: https://anaconda.org/bjodah/pykinsol

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

To compile from source you may proceed e.g. as follows:

$ LLAPACK=openblas python3.4 setup.py install --user

where we specified specifically what LAPACK implementation we used for building SUNDIALS.

Examples

See examples/, and rendered jupyter notebooks here: http://hera.physchem.kth.se/~pykinsol/branches/master/examples

Here is a simple example:

>>> def f(x, fout):
...     fout[0] = x[0] + (x[0] - x[1])**3/2 - 1
...     fout[1] = x[1] + (x[1] - x[0])**3/2
...
>>> def j(x, Jout, fx):
...     Jout[0, 0] =  1 + 3/2 * (x[0] - x[1])**2
...     Jout[0, 1] =  -3/2 * (x[0] - x[1])**2
...     Jout[1, 0] =  -3/2 * (x[1] - x[0])**2
...     Jout[1, 1] =  1 + 3/2 * (x[1] - x[0])**2
...
>>> from pykinsol import solve
>>> result = solve(f, j, [0, 0])
>>> assert result['success']
>>> print(result['x'])  # doctest: +SKIP
[ 0.84116389  0.15883611]

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/pykinsol

Author

Björn I. Dahlgren, contact:

  • gmail address: bjodah

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

pykinsol-0.1.6.tar.gz (70.4 kB view details)

Uploaded Source

File details

Details for the file pykinsol-0.1.6.tar.gz.

File metadata

  • Download URL: pykinsol-0.1.6.tar.gz
  • Upload date:
  • Size: 70.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/3.5.2

File hashes

Hashes for pykinsol-0.1.6.tar.gz
Algorithm Hash digest
SHA256 5b9dc90da22dd780c21811b2c234b7a4b8c3259b75d202ba8a3e19881526cfcd
MD5 ed786a89ab2962ceb3886ed49ff11bd8
BLAKE2b-256 b37df35e84d9fd8789bd4d70c090ee788d872808c55b948353487be97b81fd7a

See more details on using hashes here.

Supported by

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