Numerical quadrature with JAX
Project description
quadax is a library for numerical quadrature and integration using JAX.
vmap-able, jit-able, differentiable.
Scalar or vector valued integrands.
Finite or infinite domains with discontinuities or singularities within the domain of integration.
Globally adaptive Gauss-Kronrod and Clenshaw-Curtis quadrature for smooth integrands (similar to scipy.integrate.quad)
Adaptive tanh-sinh quadrature for singular or near singular integrands.
Quadrature from sampled values using trapezoidal and Simpsons methods.
Coming soon:
Custom JVP/VJP rules (currently AD works by differentiating the loop which isn’t the most efficient.)
N-D quadrature (cubature)
QMC methods
Integration with weight functions
Sparse grids (maybe, need to play with data structures and JAX)
Installation
quadax is installable with pip:
pip install quadax
Usage
import jax.numpy as jnp
import numpy as np
from quadax import quadgk
fun = lambda t: t * jnp.log(1 + t)
epsabs = epsrel = 1e-5 # by default jax uses 32 bit, higher accuracy requires going to 64 bit
a, b = 0, 1
y, info = quadgk(fun, [a, b], epsabs=epsabs, epsrel=epsrel)
assert info.err < max(epsabs, epsrel*abs(y))
np.testing.assert_allclose(y, 1/4, rtol=epsrel, atol=epsabs)
For full details of various options see the API documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quadax-0.2.13.tar.gz.
File metadata
- Download URL: quadax-0.2.13.tar.gz
- Upload date:
- Size: 36.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
136359729026d42f8566dbdbfa361dab78ac906ffb8363705434fc5d4957354b
|
|
| MD5 |
f7ce00ceac637ffa724da43968186402
|
|
| BLAKE2b-256 |
1159d45759a97e8acb0266444a3452c98139d4a75ada6ccf4020d62a09f4ac03
|
Provenance
The following attestation bundles were made for quadax-0.2.13.tar.gz:
Publisher:
release.yml on f0uriest/quadax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quadax-0.2.13.tar.gz -
Subject digest:
136359729026d42f8566dbdbfa361dab78ac906ffb8363705434fc5d4957354b - Sigstore transparency entry: 1333727346
- Sigstore integration time:
-
Permalink:
f0uriest/quadax@0da4e28969555c19c0cd72e3edfaba08f4a64546 -
Branch / Tag:
refs/tags/v0.2.13 - Owner: https://github.com/f0uriest
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0da4e28969555c19c0cd72e3edfaba08f4a64546 -
Trigger Event:
release
-
Statement type:
File details
Details for the file quadax-0.2.13-py3-none-any.whl.
File metadata
- Download URL: quadax-0.2.13-py3-none-any.whl
- Upload date:
- Size: 31.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ab69b77cc3ecdf64fcb1c5091bcadd280386406eab3609002808084860a3eb0
|
|
| MD5 |
1c1f3ae441c9b928ca4b29af0ce678e1
|
|
| BLAKE2b-256 |
22cc4fa4d2ac1c1a4c3d300f0f49f6052f34c13a0dcb8a5d9134a725c8410626
|
Provenance
The following attestation bundles were made for quadax-0.2.13-py3-none-any.whl:
Publisher:
release.yml on f0uriest/quadax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quadax-0.2.13-py3-none-any.whl -
Subject digest:
4ab69b77cc3ecdf64fcb1c5091bcadd280386406eab3609002808084860a3eb0 - Sigstore transparency entry: 1333727509
- Sigstore integration time:
-
Permalink:
f0uriest/quadax@0da4e28969555c19c0cd72e3edfaba08f4a64546 -
Branch / Tag:
refs/tags/v0.2.13 - Owner: https://github.com/f0uriest
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0da4e28969555c19c0cd72e3edfaba08f4a64546 -
Trigger Event:
release
-
Statement type: