Skip to main content

GPU+autodiff-capable ODE/SDE/CDE solvers written in JAX.

Project description

Diffrax

Numerical differential equation solvers in JAX. Autodifferentiable and GPU-capable.

Diffrax is a JAX-based library providing numerical differential equation solvers.

Features include:

  • ODE/SDE/CDE (ordinary/stochastic/controlled) solvers;
  • lots of different solvers (including Tsit5, Dopri8, symplectic solvers, implicit solvers);
  • vmappable everything (including the region of integration);
  • using a PyTree as the state;
  • dense solutions;
  • multiple adjoint methods for backpropagation;
  • support for neural differential equations.

From a technical point of view, the internal structure of the library is pretty cool -- all kinds of equations (ODEs, SDEs, CDEs) are solved in a unified way (rather than being treated separately), producing a small tightly-written library.

Installation

pip install diffrax

Requires Python >=3.7 and JAX >=0.2.27.

Documentation

Available at https://docs.kidger.site/diffrax.

Quick example

from diffrax import diffeqsolve, ODETerm, Dopri5
import jax.numpy as jnp

def f(t, y, args):
    return -y

term = ODETerm(f)
solver = Dopri5()
y0 = jnp.array([2., 3.])
solution = diffeqsolve(term, solver, t0=0, t1=1, dt0=0.1, y0=y0)

Here, Dopri5 refers to the Dormand--Prince 5(4) numerical differential equation solver, which is a standard choice for many problems.

Citation

If you found this library useful in academic research, please cite: (arXiv link)

@phdthesis{kidger2021on,
    title={{O}n {N}eural {D}ifferential {E}quations},
    author={Patrick Kidger},
    year={2021},
    school={University of Oxford},
}

(Also consider starring the project on GitHub.)

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

diffrax-0.0.5.tar.gz (102.9 kB view details)

Uploaded Source

Built Distribution

diffrax-0.0.5-py3-none-any.whl (107.6 kB view details)

Uploaded Python 3

File details

Details for the file diffrax-0.0.5.tar.gz.

File metadata

  • Download URL: diffrax-0.0.5.tar.gz
  • Upload date:
  • Size: 102.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for diffrax-0.0.5.tar.gz
Algorithm Hash digest
SHA256 006ae17286deec95541ec2ffc0506c101e62dc1932296e52948d2556ae2c5a28
MD5 a7f6bd73a4f738b4a2b0ff4c53cee6c8
BLAKE2b-256 37ae15564ec5bf27d5d997b03879903c7bec67b43a48378f75e3986375e7eb32

See more details on using hashes here.

File details

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

File metadata

  • Download URL: diffrax-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 107.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for diffrax-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 98066791704d1ca8632965b6631aac1d7d06532646c0fed29c2d9682777a15b6
MD5 503a32817bbdddcbfdac739dc326d592
BLAKE2b-256 ae9188b56e70926996b2777271ac0c68f1e433de3a777d3bd00de23b7a5aa011

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