Spectral derivatives beat every power of N
The spectral error is below by ; the central difference falls like and is above at .
central differencespectral (Fourier)
| Quantity | Viv | Checked by |
|---|---|---|
err fd | [0.340202, 0.0935886, 0.0258325, … ] (5 values) | the central difference's error falls by 3.9 to 4.1 per doubling from 32 to 128 |
spectral at 32 | 3.66374 × 10−14 | the spectral derivative's error is below 1e-12 by N = 32 |
fd at 128 | 0.00163133 | and is still above 1e-4 at N = 128 |
spectral_derivative.viv
Output · native build · Oct 14, 2026 · 0.91 s
err_spectral: [0.00431791, 1.76189e-07, 3.66374e-14, 1.803e-13, 5.71543e-13] err_fd: [0.340202, 0.0935886, 0.0258325, 0.0065118, 0.00163133] spectral_at_32: 3.66374e-14 fd_at_128: 0.00163133
- ✓ the spectral derivative's error is below 1e-12 by N = 32
- ✓ the central difference's error falls by 3.9 to 4.1 per doubling from 32 to 128
- ✓ and is still above 1e-4 at N = 128
Open in the workbenchAtlasMore math claims
- Full statement
- For the periodic function on equally spaced points, the Fourier (spectral) derivative's largest error falls faster than any power of , below by , while the second-order central difference's error falls only like (by a factor between 3.9 and 4.1 each time doubles from 32 to 128) and is still above at .
- Scope
- The spectral derivative is computed by a direct discrete Fourier transform (, no FFT) with the Nyquist mode set to zero; one function, analytic in a strip. A function with a jump or a kink converges only algebraically by either method.
- Reference
- The exact derivative ; Trefethen, Spectral Methods in MATLAB (2000), chapters 3 and 4 (the spectral derivative of an analytic periodic function converges geometrically).
claims/math/spectral_derivative.viv#566de00ffe