Projects/Foundations/Adaptive quadrature versus Gauss-Legendre for oscillatory integrals — controlled synthetic benchmark
Level 4 · advanced · ~11 h
Adaptive quadrature versus Gauss-Legendre for oscillatory integrals — controlled synthetic benchmark
Evaluate a family of highly oscillatory integrals with Simpson, adaptive Simpson and fixed-order Gauss-Legendre, and record cost against accuracy. Use a fixed seed, a controlled ground truth, and an ablation grid over the key hyperparameter.
Prerequisites
Problem statement
- 01Evaluate a family of highly oscillatory integrals with Simpson, adaptive Simpson and fixed-order Gauss-Legendre, and record cost against accuracy. Use a fixed seed, a controlled ground truth, and an ablation grid over the key hyperparameter.
Real-world motivation
- 01Oscillation defeats low-order polynomial rules and exposes the cost-accuracy tradeoff in adaptive refinement. The controlled synthetic benchmark setting forces concrete choices about data, scale and evaluation.
Learning objectives
- 01Implement three quadrature rules
- 02Measure function evaluations
- 03Explain failure at high frequency
- 04Report relative error against the analytic ground truth alongside the baseline metrics.
Technical architecture
- 01fixed Simpson grid
- 02adaptive bisection with error estimate
- 03Gauss-Legendre nodes via numpy.polynomial
Mathematical foundations
- 01adaptive error estimate $E=|S_{2h}-S_h|/15$
- 02Gauss-Legendre exactness degree $2m-1$ for $m$ nodes
Dataset and sources
- 01synthetic matrices generated with numpy.random.default_rng(42)
- 02condition numbers 1, 10, 100, 1000
Step-by-step tasks
- 01Frame the task and freeze the controlled synthetic benchmark evaluation protocol with a fixed random seed.
- 02Implementation 1: Implement recursive adaptive Simpson with a depth cap
- 03Implementation 2: Use known analytic truth values
- 04Implementation 3: Sweep frequency from 1 to 1000
- 05Verification 1: Check exactness on polynomials of degree up to 2m-1
- 06Verification 2: Verify error estimate bounds true error
- 07Run the ablation grid and report relative error against the analytic ground truth over three independent trials.
Implementation requirements
- 01Implement recursive adaptive Simpson with a depth cap
- 02Use known analytic truth values
- 03Sweep frequency from 1 to 1000
- 04Log all hyperparameters and the random seed for the controlled synthetic benchmark run.
Testing requirements
- 01Check exactness on polynomials of degree up to 2m-1
- 02Verify error estimate bounds true error
- 03Measure relative error against the analytic ground truth over at least three seeds.
Evaluation metrics
- 01absolute error
- 02function evaluations
- 03wall-clock time
- 04relative error against the analytic ground truth
Expected outputs
- 01error-versus-frequency plot
- 02cost table
Common failure modes
- 01adaptive Simpson misses oscillations when the initial sample aliases
- 02Gauss rule needs many nodes at high frequency
- 03ill-conditioning above 1e3 makes double precision futile
Stretch goals
- 01implement Clenshaw-Curtis
- 02use Filon quadrature for oscillatory integrands
- 03repeat in float32 and quantify the extra error floor
Research extensions
- 01derive node counts for a target accuracy
- 02study aliasing in adaptive schemes
GitHub submission requirements
- 01A repository whose README states the controlled synthetic benchmark protocol and the exact command to reproduce it.
- 02Source for the scratch implementation, a test file, and a results table with uncertainty estimates.
- 03A two-page report explaining failures on synthetic matrices generated with numpy.random.default_rng(42) and what the ablation revealed.
Completion rubric
- 01rules implemented correctly
- 02cost measured
- 03aliasing diagnosed
- 04Extra credit: repeat in float32 and quantify the extra error floor
Submit when every rubric item is satisfied and your repository contains runnable code plus a reproduction command.