Repository navigation
Replace the Ahrens-Beylkin grid of degree 39 by the rule with 572 points - #357
Conversation
The tabulated grid of 552 points for degree 39 is not a quadrature rule: its weights sum to 0.9632 * 4 pi, and no choice of weights for its points integrates the polynomials of degree 39. The table of the paper has 572 nodes, because the 20 nodes of the orbit of the face centres of the icosahedron were lost in the data file with 552 rows. Add the 20 face centres with the weight that gives the sum of 4 pi, 0.0230948723 (all weights are positive). The grid integrates all polynomials up to degree 39 with an error of 1e-14 and fails at degree 40, as a rule of degree 39 should. It agrees with the table of IntegratorXX (issue 108, pull request 113) to 3e-14. Requests for degree 38 and 39, or for sizes up to 572, now give this grid. Add a test that checks the points and the weights of every tabulated angular grid. It fails for the old grid and is the only failure of the 450 grids.
|
The workflows of this PR are waiting for approval to run, because it is my first PR to this repository. Locally the whole test suite passes with the change (1199 passed, 1 skipped), including the new test, which fails on master for the grid with 552 points only. @marco-2023, you added the Ahrens-Beylkin grids in #317, so could you have a look, and approve the workflows if that is ok? If you plan to regenerate the whole family for #318, this PR can also just serve as the check for the existing grids. |
There was a problem hiding this comment.
🔵 Needs a closer look
The change replaces a large numerical quadrature table, and confirming degree-39 accuracy and packaged-data loading requires unavailable NumPy-based tests and binary-data validation.
No open issues 🎉
What changed in this PR
This pull request replaces the invalid 552-point Ahrens-Beylkin degree-39 quadrature rule with the corrected 572-point rule and adds validation for packaged angular grids.
Changes:
- Updates the Ahrens-Beylkin size-to-degree mapping from 552 to 572 points.
- Preserves selection of the corrected rule for degree 38–39 and sizes 493–572.
- Adds parametrized tests for point normalization, weight sums, and polynomial integration.
| File | Description |
|---|---|
| src/grid/tests/test_angular.py | Adds parametrized validation of point norms, weight sums, and polynomial integration across packaged angular grids. |
| src/grid/angular.py | Updates the Ahrens-Beylkin degree-39 mapping to use the corrected 572-point rule and adds grid validation coverage. |
Review effort: Lite
The tabulated Ahrens-Beylkin grid of degree 39 (552 points) is not a valid quadrature rule. Its weights sum to 0.9632 * 4 pi, so it does not even integrate a constant, and it was used silently for any request of degree 38 or 39 or of size 552. I found it by checking that every tabulated angular grid integrates
(u . x)^kexactly up to its degree: all 450 grids of the four families pass except this one.Cause. The data came from IntegratorXX (#317), where the same grid was reported as wavefunction91/IntegratorXX#108 by @susilehtola, who also found the reason in wavefunction91/IntegratorXX#113: the rule in the paper (Ahrens and Beylkin, Proc. R. Soc. A 465, 3103 (2009)) has 572 nodes, and the 20 nodes of the orbit of the face centres of the icosahedron are missing in the file with 552 rows. The missing weight is exactly the deficit: 20 * 0.0230948723 = 4 pi - sum(w).
Change.
(4 pi - sum(w)) / 20, and store the result asahrens_beylkin_39_572.npzinstead ofahrens_beylkin_39_552.npz. The size inAHRENS_BEYLKIN_NPOINTSchanges from 552 to 572.test_every_packaged_grid_is_a_quadrature_of_its_degree: for each of the 450 tabulated grids it checks the unit norm of the points, the sum of the weights, and the integral of(u . x)^kfor random directions and k up to min(degree, 30). It fails on master for this grid only and it takes about 20 s.I did not touch the other Ahrens-Beylkin grids (#318): all of them pass the test. The existing test file passes (489 tests).