########
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-Konrod 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.8",
"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/d0/76/d86f5ce985909299d1382ba7b3b5dfa8d5bc120ce098a74ca4b562be5821/quadax-0.2.3.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-Konrod 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.3",
"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": "",
"digests": {
"blake2b_256": "0279675c0df5393d6d07087c7caf68cc6a3894886d8dd34cf1a58516543ff89b",
"md5": "b854feb36b26c38fe90c79991e0ccc76",
"sha256": "6372de788408eb578e59158cf1b40cfff1f1d37d3ccdb852f3a45fb3d79de501"
},
"downloads": -1,
"filename": "quadax-0.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b854feb36b26c38fe90c79991e0ccc76",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 31120,
"upload_time": "2024-10-27T00:41:00",
"upload_time_iso_8601": "2024-10-27T00:41:00.123991Z",
"url": "https://files.pythonhosted.org/packages/02/79/675c0df5393d6d07087c7caf68cc6a3894886d8dd34cf1a58516543ff89b/quadax-0.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d076d86f5ce985909299d1382ba7b3b5dfa8d5bc120ce098a74ca4b562be5821",
"md5": "c75061b3d83bde7642f6cf1a65fc1d35",
"sha256": "e88cb984737edcb7755df7e04bfd9642df0d9d49b0b4d76024c8c03dcee76bc4"
},
"downloads": -1,
"filename": "quadax-0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "c75061b3d83bde7642f6cf1a65fc1d35",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 34865,
"upload_time": "2024-10-27T00:41:01",
"upload_time_iso_8601": "2024-10-27T00:41:01.897110Z",
"url": "https://files.pythonhosted.org/packages/d0/76/d86f5ce985909299d1382ba7b3b5dfa8d5bc120ce098a74ca4b562be5821/quadax-0.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-27 00:41:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "f0uriest",
"github_project": "quadax",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "quadax"
}