########
quadax
########
|License| |DOI| |Issues| |Pypi|
|Docs| |UnitTests| |Codecov|
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`:
.. code-block:: console
pip install quadax
Usage
=====
.. code-block:: python
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 <https://quadax.readthedocs.io/en/latest/api.html>`__
.. |License| image:: https://img.shields.io/github/license/f0uriest/quadax?color=blue&logo=open-source-initiative&logoColor=white
:target: https://github.com/f0uriest/quadax/blob/master/LICENSE
:alt: License
.. |DOI| image:: https://zenodo.org/badge/709132830.svg
:target: https://zenodo.org/doi/10.5281/zenodo.10035983
:alt: DOI
.. |Docs| image:: https://img.shields.io/readthedocs/quadax?logo=Read-the-Docs
:target: https://quadax.readthedocs.io/en/latest/?badge=latest
:alt: Documentation
.. |UnitTests| image:: https://github.com/f0uriest/quadax/actions/workflows/unittest.yml/badge.svg
:target: https://github.com/f0uriest/quadax/actions/workflows/unittest.yml
:alt: UnitTests
.. |Codecov| image:: https://codecov.io/github/f0uriest/quadax/graph/badge.svg?token=MB11I7WE3I
:target: https://codecov.io/github/f0uriest/quadax
:alt: Coverage
.. |Issues| image:: https://img.shields.io/github/issues/f0uriest/quadax
:target: https://github.com/f0uriest/quadax/issues
:alt: GitHub issues
.. |Pypi| image:: https://img.shields.io/pypi/v/quadax
:target: https://pypi.org/project/quadax/
:alt: Pypi
Raw data
{
"_id": null,
"home_page": "https://github.com/f0uriest/quadax",
"name": "quadax",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "integration quadrature gauss kronrod tanh sinh romberg adaptive",
"author": "Rory Conlin",
"author_email": "wconlin@princeton.edu",
"download_url": "https://files.pythonhosted.org/packages/f6/a0/df4a3f61e90039e8e70100199d4b80a2529e876cebba8818c86218e6ea83/quadax-0.2.9.tar.gz",
"platform": null,
"description": "\n########\nquadax\n########\n|License| |DOI| |Issues| |Pypi|\n\n|Docs| |UnitTests| |Codecov|\n\nquadax is a library for numerical quadrature and integration using JAX.\n\n- ``vmap``-able, ``jit``-able, differentiable.\n- Scalar or vector valued integrands.\n- Finite or infinite domains with discontinuities or singularities within the domain of integration.\n- Globally adaptive Gauss-Kronrod and Clenshaw-Curtis quadrature for smooth integrands (similar to ``scipy.integrate.quad``)\n- Adaptive tanh-sinh quadrature for singular or near singular integrands.\n- Quadrature from sampled values using trapezoidal and Simpsons methods.\n\nComing soon:\n\n- Custom JVP/VJP rules (currently AD works by differentiating the loop which isn't the most efficient.)\n- N-D quadrature (cubature)\n- QMC methods\n- Integration with weight functions\n- Sparse grids (maybe, need to play with data structures and JAX)\n\nInstallation\n============\n\nquadax is installable with `pip`:\n\n.. code-block:: console\n\n pip install quadax\n\n\n\nUsage\n=====\n\n.. code-block:: python\n\n import jax.numpy as jnp\n import numpy as np\n from quadax import quadgk\n\n fun = lambda t: t * jnp.log(1 + t)\n\n epsabs = epsrel = 1e-5 # by default jax uses 32 bit, higher accuracy requires going to 64 bit\n a, b = 0, 1\n y, info = quadgk(fun, [a, b], epsabs=epsabs, epsrel=epsrel)\n assert info.err < max(epsabs, epsrel*abs(y))\n np.testing.assert_allclose(y, 1/4, rtol=epsrel, atol=epsabs)\n\n\nFor full details of various options see the `API documentation <https://quadax.readthedocs.io/en/latest/api.html>`__\n\n\n.. |License| image:: https://img.shields.io/github/license/f0uriest/quadax?color=blue&logo=open-source-initiative&logoColor=white\n :target: https://github.com/f0uriest/quadax/blob/master/LICENSE\n :alt: License\n\n.. |DOI| image:: https://zenodo.org/badge/709132830.svg\n :target: https://zenodo.org/doi/10.5281/zenodo.10035983\n :alt: DOI\n\n.. |Docs| image:: https://img.shields.io/readthedocs/quadax?logo=Read-the-Docs\n :target: https://quadax.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation\n\n.. |UnitTests| image:: https://github.com/f0uriest/quadax/actions/workflows/unittest.yml/badge.svg\n :target: https://github.com/f0uriest/quadax/actions/workflows/unittest.yml\n :alt: UnitTests\n\n.. |Codecov| image:: https://codecov.io/github/f0uriest/quadax/graph/badge.svg?token=MB11I7WE3I\n :target: https://codecov.io/github/f0uriest/quadax\n :alt: Coverage\n\n.. |Issues| image:: https://img.shields.io/github/issues/f0uriest/quadax\n :target: https://github.com/f0uriest/quadax/issues\n :alt: GitHub issues\n\n.. |Pypi| image:: https://img.shields.io/pypi/v/quadax\n :target: https://pypi.org/project/quadax/\n :alt: Pypi\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Numerical quadrature with JAX",
"version": "0.2.9",
"project_urls": {
"Contributing": "https://github.com/f0uriest/quadax/blob/master/CONTRIBUTING.rst",
"Documentation": "https://quadax.readthedocs.io/",
"Homepage": "https://github.com/f0uriest/quadax",
"Issues Tracker": "https://github.com/f0uriest/quadax/issues",
"Source Code": "https://github.com/f0uriest/quadax/"
},
"split_keywords": [
"integration",
"quadrature",
"gauss",
"kronrod",
"tanh",
"sinh",
"romberg",
"adaptive"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "24e907b545bda225fb8ccff5e5d20361bd90f352d8df8380adcd5f59e149ca65",
"md5": "88d4c8c38541e6b3416ff3ddbc92b8a3",
"sha256": "41c72d919294a2db3afa797d1ea1183f960d04f4aaec383267d16df68c76e267"
},
"downloads": -1,
"filename": "quadax-0.2.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "88d4c8c38541e6b3416ff3ddbc92b8a3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 30730,
"upload_time": "2025-07-31T00:31:45",
"upload_time_iso_8601": "2025-07-31T00:31:45.090019Z",
"url": "https://files.pythonhosted.org/packages/24/e9/07b545bda225fb8ccff5e5d20361bd90f352d8df8380adcd5f59e149ca65/quadax-0.2.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f6a0df4a3f61e90039e8e70100199d4b80a2529e876cebba8818c86218e6ea83",
"md5": "b9281e8b222fd2e672ee2e4e98f16ba5",
"sha256": "594ffddc0af894d9d89fd145dc3907168d6ead29e05e266548b2365b850eda51"
},
"downloads": -1,
"filename": "quadax-0.2.9.tar.gz",
"has_sig": false,
"md5_digest": "b9281e8b222fd2e672ee2e4e98f16ba5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 35445,
"upload_time": "2025-07-31T00:31:46",
"upload_time_iso_8601": "2025-07-31T00:31:46.377984Z",
"url": "https://files.pythonhosted.org/packages/f6/a0/df4a3f61e90039e8e70100199d4b80a2529e876cebba8818c86218e6ea83/quadax-0.2.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-31 00:31:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "f0uriest",
"github_project": "quadax",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "equinox",
"specs": [
[
"<",
"0.14"
],
[
">=",
"0.11.0"
]
]
},
{
"name": "jax",
"specs": [
[
">=",
"0.4.36"
],
[
"<",
"0.8"
]
]
},
{
"name": "numpy",
"specs": [
[
">=",
"1.20.0"
],
[
"<",
"2.4"
]
]
}
],
"lcname": "quadax"
}