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 hashes)

Uploaded Python 3

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