Skip to main content

Ordinary differential equation zoo

Project description

diffeqzoo

PyPi Version Docs GitHub stars gh-actions License Badge

So, what was the initial condition of the restricted three-body problem again?

diffeqzoo delivers all differential equation test problems in one place. It works with numpy and jax.

Installation

Get the most recent stable version from PyPi:

pip install diffeqzoo

Or directly from GitHub:

pip install git+https://github.com/pnkraemer/diffeqzoo.git

These commands assume that NumPy or JAX are installed separately by the user. Read more about installing this package here.

Features include

  • Oscillating systems (Lotka-Volterra, Fitzhugh-Nagumo, Van-der-Pol, ...)
  • Chaotic systems (Lorenz63, Lorenz96, Roessler, ...)
  • Epidemiological models (SIR, SEIR, SIRD, ...)
  • N-Body problems and celestial mechanics (Rigid-body, restricted-three-body, Pleiades, Henon-Heiles, ...)
  • Chemical reactions (HIRES, ROBER, ...)
  • Boundary value problems

As well as

  • Flexibly NumPy and JAX-backends. Other than one of those two, there are 0 (zero!) dependencies.
  • Mathematical descriptions and BibTex entries of the ODE problems
  • Compatibility with all NumPy/JAX-based ODE solvers: SciPy, JAX, Diffrax, ProbNum, Tornadox, etc..

and many more goodies.

Quick example

>>> from diffeqzoo import ivps, backend
>>> backend.select("numpy")
>>>
>>> # Create test problems like this
>>> f, u0, t_span, f_args = ivps.lotka_volterra()
>>> x = f(u0, *f_args)
>>> print(x)
[-10.  10.]
>>>
>>> # The numpy backend determines the type of input/output
>>> print(type(x))
<class 'numpy.ndarray'>
>>>
>>> # All sorts of ODEs are available, e.g., Rigid-Body:
>>> f, u0, t_span, f_args = ivps.rigid_body()
>>> print(f(u0, *f_args))
[-0.     1.125 -0.   ]
>>>
>>> ## make it jax
>>> backend.change_to("jax")
>>> f, u0, t_span, f_args = ivps.rigid_body()
>>> x = f(u0, *f_args)
>>> print(x)
[-0.     1.125 -0.   ]
>>> print(type(x))
<class 'jaxlib.xla_extension.ArrayImpl'>

Similar projects

  • F. Mazzia et al. published a test set for IVP solvers for Matlab and Fortran. There is a similar test set for BVP solvers. Neither one offers Python code, and both also run benchmarks, which diffeqzoo does not care about at all.
  • E. Hairer et al. published their stiff ODE test set, but there is no Python code
  • NonlinearBenchmark hosts datasets of nonlinear dynamical system observations. They are quite specialised problems, and don't contain the textbook problems like Lotka-Volterra, van der Pol, etc..
  • DifferentialEquations.jl provides example ODE problems in Julia.
  • ProbNum's problem zoo offers a similar set of problems to diffeqzoo (no surprise -- the set of authors intersects) but tied to ProbNum's ODE solver interface. diffeqzoo is less of an API, switches more flexibly between numpy and jax (at the time of developing), and contains more problems.
  • W. Gilpin published a benchmark for forecasting and data-driven modeling, which comes with a large number of (mostly chaotic) dynamical systems.
  • J. Meier lists a number of ODE attractors on his website.
  • GeometricProblems.jl curates a similar list of example problems with interesting geometric structure, in Julia (link)

Anything missing in this list? Please open an issue or make a pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

diffeqzoo-0.0.5-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file diffeqzoo-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: diffeqzoo-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for diffeqzoo-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 981d2b52a930fbf6cedc924d4a61f0cc64851fba601f8aa407adbb5d183a1951
MD5 3222a16e1155b6b573168d2adadf2295
BLAKE2b-256 65ffbd4e237a4802d359f8fca969087736e6237872b3e4335c1957161d927c00

See more details on using hashes here.

Supported by

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