star-quadrature 0.1.0
Gauss-Legendre quadrature
Public state: Released & Verified. The registry label is RELEASED. What the states mean →
Apache-2.0 Released & Verified single file
Summary
Gauss-Legendre nodes and weights for 1 to 32 points, each node the float nearest to the true root (exact coefficients, exact-sign bisection) and each weight evaluated exactly and rounded once; fixed-rule integration and Legendre polynomials with derivative; all 528 nodes and weights equal SymPy's 40-digit values rounded to a float.
Run in your browser
Edit the code and press Run (or Ctrl+Enter). Python runs in your browser with this package's published code. The first run downloads Python once (about 12 MB).
Runs in the browser: all 81 tests pass in the browser's Python (Pyodide 314.0.7, Python 3.14.2), measured on 20 October 2026.
Use it on your computer
No account and no GitHub needed. Download, then install with one command:
- Install file · star_quadrature-0.1.0-py3-none-any.whl 4 kB
- Single file — copy it alongside your code · star_quadrature.py 7 kB
- Source code (.zip) 25 kB
python -m pip install star_quadrature-0.1.0-py3-none-any.whlIn Python: import star_quadrature
Cite it, and its bill of materials
For a paper, a report or a supplier file: the citation in two formats, and the software bill of materials (SBOM) in the two standard formats, with the fingerprint of the wheel.
@software{cavazzini_star_quadrature_0_1_0,
author = {Cavazzini, Andrea},
title = {{star-quadrature}: Gauss-Legendre quadrature},
version = {0.1.0},
year = {2026},
url = {https://andrea07072000.github.io/S.T.A.R.-/software/star_quadrature/},
note = {Apache-2.0. Source: https://github.com/Andrea07072000/S.T.A.R.-, commit dc09f61d}
}
For developers
Install directly from the public repository:
python -m pip install "star-quadrature @ git+https://github.com/Andrea07072000/S.T.A.R.-.git@dc09f61dcee098d518f070d6a23a8815defc1109#subdirectory=packages/star_quadrature"
Technical sheet
Requirements
- R1
gauss_legendre(n)returns the n nodes (increasing) and the n weights of the rule on [-1, 1], for n from 1 to 32. Each node is the float nearest to the true root of P_n: the polynomial is built with exact coefficients and the root is found by bisection over the floats with the exact sign. Each weight is evaluated in exact arithmetic and rounded once. Nodes are exactly antisymmetric and weights exactly symmetric. - R2
integrate(f, a, b, n)applies the n-point rule to [a, b];legendre(n, x)returns P_n(x) and P_n'(x) for x in [-1, 1] by the three-term recurrences (no division by 1 - x²). - R3 Measured on all 32 rules (528 nodes and weights): every node and every weight equals SymPy's 40-digit value rounded to a float. 400 Legendre values with derivatives and 120 exact integrals of monomials agree with SymPy within 1e-14 relative; NumPy and SciPy agree within their own accuracy.
- R4 Every function returns floats or raises
ValueError: n that is not an integer in range (booleans and floats refused), x outside [-1, 1], limits that are not finite numbers within 1e150, f that is not callable or returns something that is not a finite real number, an overflowing result.
Limits (what is not claimed)
Fixed rules only: no adaptive integration, no error estimate, no other weight functions (Gauss-Lobatto, Laguerre, Hermite, Kronrod), no rule beyond 32 points. The rule is exact only for polynomials up to degree 2n - 1; for any other function the result is an approximation whose error this module does not bound: singular, discontinuous or strongly oscillating integrands need more than a fixed rule. The first call for a given n builds the rule in exact arithmetic (about two seconds for all rules up to 32 points on a laptop); later calls are cached. legendre is double-precision recurrence, accurate to about 1e-14 relative to the size of the value.
Release gate
Computed by the registry from the result files, with the same function that decides RELEASED.
- Mutation score, latest measure of each module (needs at least 0.850)
- star_quadrature.py 0.960 (2026-10-07)
- Independent implementations written by others (needs 2)
- numpy.polynomial.legendre, scipy.special / scipy.integrate.fixed_quad, SymPy gauss_legendre at 40 digits and exact Legendre polynomials
- Result
- Released & Verified
Evidence in the registry
| Check | Status | Recorded | What was observed |
|---|---|---|---|
| Clean install from the release tag | VERIFIED | 2026-10-07 | pytest outside the tree: 81 passed in 9.51s |
| Unit tests | VERIFIED | 2026-10-07 | 81 passed in 9.69s |
| Review | VERIFIED | 2026-10-07 | Requirements, interface, units, data provenance, dependency surface and failure behaviour reviewed |
| Review | VERIFIED | 2026-10-07 | Re-running the cross-check gives a byte-identical evidence file |
| Reference value | VERIFIED | 2026-10-07 | gauss_legendre(2) = ((-0.5773502691896257, 0.5773502691896257), (1.0, 1.0)); gauss_legendre(3) = ((-0.7745966692414834, 0.0, 0.7745966692414834), (0.5555555555555556, 0.8888888888888888, 0.5555555555555556)) (suite: 81 passed in 9.69s) |
| Cross-check with independent libraries | VERIFIED | 2026-10-07 | star_quadrature returns Gauss-Legendre nodes that are the floats nearest to the true roots and weights correct to the last digit, for 1 to 32 points |
| Benchmark | VERIFIED | 2026-10-07 | largest relative difference of a weight from SymPy at 40 digits: 0.0e+00; of a node: 0.0 |
Fingerprints (SHA-256)
| star_quadrature-0.1.0-py3-none-any.whl | 853d77c7fef2cb0796ca9d8566e786139bfed16eace0f7a4851c149e5978d2f3 |
| star_quadrature.py | 2253aaa903aa2f21955c9bf0472ee17e596f642969e47b1daf702c5c31b8aa33 |
| star_quadrature-0.1.0-source.zip | 2bf80a21ae3bd368cee27efd9e7de4f6057273d6f95a55196f80ea2544db5085 |
