The trapezoid rule is spectrally accurate on periodic functions
16 points give to , while on is off by .
exp(x) on [0, 1]exp(cos t) over a period
| Quantity | Viv | Checked by |
|---|---|---|
rel err periodic | 0 | the periodic integrand: relative error below 1e-14 with 16 points |
rel err exp | 0.0003255 | exp over [0, 1]: relative error about 3.3e-4 |
halving factor | 3.9998 | halving h divides the error by between 3.9 and 4.1 |
trapezoid_periodic.viv
Output · native build · Oct 14, 2026 · 0.74 s
rel_err_periodic: 0 rel_err_exp: 0.0003255 halving_factor: 3.9998
- ✓ the periodic integrand: relative error below 1e-14 with 16 points
- ✓ exp over [0, 1]: relative error about 3.3e-4
- ✓ halving h divides the error by between 3.9 and 4.1
Open in the workbenchAtlasMore math claims
- Full statement
- With 16 points the trapezoid rule integrates the periodic over a full period to a relative error below , while on the non-periodic over its relative error is about and falls only like (by a factor between 3.9 and 4.1 per halving of ).
- Scope
- Two integrands; the exponential convergence needs the integrand smooth and periodic over the interval.
- Reference
- The integral of over is with (Abramowitz and Stegun 9.8.1 tables); the integral of over is . Trefethen and Weideman, "The exponentially convergent trapezoidal rule", SIAM Review 56 (2014) 385-458.
claims/math/trapezoid_periodic.viv#05e1b9e3b8