Skip to main content

ODE integrator for JAX

Project description

Lint and test XAJ Publish XAJ to PyPI

XAJ

Ordinary differential equation (ODE) integrator compatible with Google's JAX.

XAJ implements the Runge-Kutta Dormand-Prince 4/5 pair (DP5) with adaptive step control and dense output according to the Numerical Recipes. It provides a fast and efficient way to solve non-stiff ODEs. The programming interface is designed so it feels similar to the derivative functions in JAX.

Specifically, XAJ provides a single function odeint(). Applying it to another function rhs() and the initial conditions returns the numerical solution as a callable ns, which interpolates the dense output.

from xaj import odeint
from jax import numpy as np

rhs = lambda x, y: y
x0  = 0
y0  = 1

ns  = odeint(rhs, x0, y0, 1)

x   = np.linspace(0, 5)
y   = ns(x)

The numerical integration happens in a "lazy" way, which is triggered by the extreme values of the argument of ns. Alternatively, it is possible to obtain the numerical solutions at the full steps by

xs = ns.xs
ys = ns.ys

Demos on how to use XAJ can be found in the demos directory.

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

xaj-0.1.7.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

xaj-0.1.7-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file xaj-0.1.7.tar.gz.

File metadata

  • Download URL: xaj-0.1.7.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.6

File hashes

Hashes for xaj-0.1.7.tar.gz
Algorithm Hash digest
SHA256 a4e208c8e1fd39adde7c1951818b97c91fe8c694b4787c3401b8fda355c72e1b
MD5 4b73eafe3aeb134ca37de06c02ed8314
BLAKE2b-256 242bd67d050c7ee2f0f3cdfff5053ba0b0a48aabadeddd007fc951290acf7817

See more details on using hashes here.

File details

Details for the file xaj-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: xaj-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.6

File hashes

Hashes for xaj-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ba7aa307c18d91d58d90acdf567fdd0c054ae10b9ddc34f79b77e222e1d78916
MD5 7009aee58d70da20fd40c859b711e590
BLAKE2b-256 d5f479f11c0a13e79823f71a6bc46ddbbb415daee4deddd9f6a498e001f33c5f

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