gaussquad
A mini-package to compute Gauss quadrature nodes and weights for arbitrary weight functions on finite intervals using the Golub–Welsch algorithm.
Based on:
Documentation is available at thatmariia.github.io/gaussquad
Features
- Compute quadrature nodes and weights for custom weight functions
- Use them directly to approximate integrals
Installation
From PyPI:
pip install gaussquad
From GitHub:
pip install git+https://github.com/thatmariia/gaussquad.git
Requirements: Python 3.13 or newer, numpy, scipy
Usage
You can integrate x^2 * w(x) from 0 to 5 with a weight function w(x)=exp(-x):
import numpy as np
from gaussquad import wquad
result = wquad(
fn=lambda x: x**2,
weight_fn=lambda x: np.exp(-x),
interval=(0, 5),
degree=5,
moment_method="legendre" # approximation for moments
)
print(f"Integral of x^2 from 0 to 5 with weight function exp(-x): {result}") # ≈ 1.7507
More examples: docs » usage.md.
Development & docs
git clone https://github.com/thatmariia/gaussquad.git
cd gaussquad
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -e ".[dev,docs]"
| Command | Description |
|---|---|
pytest |
Run tests |
flake8 src/ |
Check code style |
black --check src/ |
Check code style |
cd docs && make html |
Build docs |
open docs/build/html/index.html |
View docs (macOS) |
python -m http.server --directory docs/build/html |
View docs (all OS) |
Citation
If you use this package in your research, please cite it using the information under "Cite this repository" on the right side of the GitHub page.
If you need a version-specific citation, you can find it on Zenodo.
License
This project is licensed under the Apache-2.0 License. See the LICENSE file for details.
Metadata
Release files for gaussquad 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gaussquad-1.0.1.tar.gz | 13.0 kB | With provenance | Details for gaussquad-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gaussquad-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for gaussquad-1.0.1-py3-none-any.whl |
Total release size: 24.9 kB
Release files / gaussquad-1.0.1.tar.gz
| Download URL | gaussquad-1.0.1.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bee1354182f5c93283370d45bbed64f68efafd9414ddc6bc32f50c64758dd8a8
|
|
BLAKE2b-256 checksum How to use checksums |
408da8ae5d1201f549d84913e8277a2b94bbce57d2b4fab063899a10181ff49b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2025.
Transparency logRelease files / gaussquad-1.0.1-py3-none-any.whl
| Download URL | gaussquad-1.0.1-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97ff00b1126e1666a1b34e131c2ed91720a81335e67cafe4b0febfc006bf2ec8
|
|
BLAKE2b-256 checksum How to use checksums |
d0587e01e0ea0bff681b0d97ef41d483f505c88f4f014e89ebd34e9804f8ad26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2025.
Transparency logSecurity for gaussquad 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for gaussquad-1.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.