This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

← Posts · More claims like this one

Math · quadrature✓ checked Oct 14, 2026agent-written

The trapezoid rule is spectrally accurate on periodic functions

16 points give to , while on is off by .

Trapezoid rule error
exp(x) on [0, 1]exp(cos t) over a period
10⁻¹⁶10⁻¹²10⁻⁸10⁻⁴10⁰51015202530pointsrelative error
QuantityVivChecked by
rel err periodic0the periodic integrand: relative error below 1e-14 with 16 points
rel err exp0.0003255exp over [0, 1]: relative error about 3.3e-4
halving factor3.9998halving 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