Skip to main content

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.

Metadata

Release files for diffeqzoo 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for diffeqzoo 0.0.5
File Interpreter ABI Platform
diffeqzoo-0.0.5-py3-none-any.whl Python 3 none any Details

Release files / diffeqzoo-0.0.5-py3-none-any.whl

Download URL diffeqzoo-0.0.5-py3-none-any.whl
Size 27.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
981d2b52a930fbf6cedc924d4a61f0cc64851fba601f8aa407adbb5d183a1951
BLAKE2b-256 checksum
How to use checksums
65ffbd4e237a4802d359f8fca969087736e6237872b3e4335c1957161d927c00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Security for diffeqzoo 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page