Fundamentals / Numerical mathematics / Approximation and quadrature / Function approximation and numerical integration

Integrating cosine interpolants on nested grids

Chebyshev points turn polynomial interpolation into a cosine series. Derive the exact moments of each basis polynomial, explain aliasing and find a case where two consecutive quadrature grids confidently agree on the wrong answer.

Use a change of coordinate to simplify both the grid and the basis

The Chebyshev polynomial \(T_k(x)\) is defined by \(T_k(\cos\theta)=\cos(k\theta)\). For \(N+1\) nodes \(x_j=\cos(j\pi/N)\), sampling a degree-\(N\) polynomial in Chebyshev coordinates becomes sampling a finite cosine series at equally spaced angles. A discrete cosine transform computes the unique interpolant's coefficients without a Vandermonde solve. Clenshaw–Curtis quadrature integrates that interpolant over \([-1,1]\). The integral is unweighted \(dx\), so in angle coordinates there is a \(\sin\theta\) Jacobian; it is not merely the trapezoidal average of the sampled values over angle.

Let \(I_k=\int_{-1}^1T_k(x)dx=\int_0^\pi\cos(k\theta)\sin\theta\,d\theta\). Odd \(k\) gives zero by parity. Using a product-to-sum identity for even \(k\) gives \(I_k=2/(1-k^2)\), including \(I_0=2\). With coefficients in the convention \(p_N=\sum_{k=0}^N a_kT_k\), the quadrature is simply

\[Q_N=\sum a_k I_k.\]

Some DCT implementations store doubled endpoint coefficients. Convert to the polynomial convention before using these moments; otherwise even the constant function can integrate to four instead of two. A quick audit is exact integration of \(1,x,x^2\) where the grid supports those degrees.

Explain why unsampled higher modes can imitate low modes

At sampling angles \(\theta_j=j\pi/N\), \(\cos[(2N-k)\theta_j]=\cos(k\theta_j)\) for integer \(j\). Frequencies folded about multiples of \(2N\) are indistinguishable on this grid. A single basis function \(T_{2N-k}\) consequently yields the same interpolant and quadrature as \(T_k\), even though the exact integrals differ. At \(N=8\), \(T_{14}\) aliases to \(T_2\), so \(Q_8=-2/3\) while the exact integral is

\[-2/195\simeq-0.01026.\]

At \(N=16\) the polynomial is fully resolved and integrated exactly. Many practical smooth integrands have rapidly decaying high-mode coefficients, limiting this effect; smoothness without a quantitative resolution check is insufficient.

The error for a convergent Chebyshev expansion can be analysed as a sum of high-mode coefficients times differences between true and aliased moments. The even moments decay roughly as \(k^{-2}\), so exact integration of many high modes contributes little, but a high mode folding to \(T_0\) can cause a large erroneous contribution. This helps explain how a rule exact for degree only \(N\) can often perform competitively with Gaussian quadrature while still suffering carefully designed aliasing failures. Number of exact polynomial moments and actual performance on an analytic function are different comparisons.

Reuse data under refinement while looking for unresolved structure

Doubling the number of intervals gives \(x_{2j}^{(2N)}=x_j^{(N)}\), so all previous samples can be reused. This is valuable when evaluating one function call involves a time-dependent model or laboratory observation. For a general interval \([a,b]\), map \(x\) affinely and multiply every integral by \((b-a)/2\). Compare successive \(Q_N\), decay of the latter Chebyshev coefficients and an independent nonnested or local check. If the integrand has an unresolved local spike or frequency intentionally locked to the grid, two nested results can agree spuriously.

For a diagnostic let \(f=T_{4N}\). Both the \(N\)- and \(2N\)-interval grids sample the constant value one, so both return 2 despite the exact integral \(2/(1-16N^2)\) being small and negative. Once the \(4N\)-interval grid resolves the highest polynomial the answer changes dramatically. This does not imply nested algorithms should always quadruple a mesh unquestioningly. When physical bounds on derivatives, a known bandwidth or local event locations are available, use them to select an initial resolution and targeted check. Without such information no deterministic finite sampling can certify arbitrary unknown integrands.

Background · Can two consecutive nested rules agree on the wrong integral?

Use the Chebyshev polynomial \(T_{4N}(x)\) on \([-1,1]\). On the fine grid \(x_j=\cos(j\pi/(2N))\), its sampled values are \(\cos(2j\pi)=1\). The coarse grid is a subset and sees exactly the same constant. Both rules consequently return the integral of one, namely 2. But the unweighted integral follows by setting \(x=\cos\theta\) and integrating \(\sin\theta\cos(4N\theta)\):

\[\int_{-1}^{1}T_{4N}(x)\,dx=\frac{2}{1-(4N)^2}.\]

At \(N=4\) both sampled estimates are 2 while the actual integral is \(-2/255\). An independent off-grid evaluation, or a refinement sequence chosen using prior frequency information, can expose the oscillation. This example pinpoints which assumption a difference-based stopping test needs: the current samples must already represent the significant scales.

Make two nested rules agree on a false integral

Take eight coarse intervals and choose degree 32. Read the two interpolated moments and derive the correct integral analytically. At degree 31 both rules also agree. Explain why they are now exact. At degree 16 determine which grid returns 2 and which resolves the true moment. What evidence distinguishes symmetry from a spurious agreement due to aliasing?

Tutorial · inspect coefficients and stopping signals

Build a three-point rule from moments

With \(N=2\) the nodes are \(1,0,-1\). Use symmetry and moments of \(1,x^2\) to obtain the weights. Integrate \(x^4\) and explain the error.

Work through the solution

Symmetry gives endpoint weights \(w\) and centre weight \(v\). Exactness of the constant requires \(2w+v=2\); for \(x^2\) it gives \(2w=2/3\), hence

\[w=1/3,v=4/3.\]

The estimate for \(x^4\) is \(2/3\) whereas the exact integral is \(2/5\), an error of \(4/15\). Although the rule integrates odd cubics by symmetry, polynomial degree four is not guaranteed. Expanded in Chebyshev modes, its unresolved \(T_4\) aliases to the constant.

Derive the error caused by one small high-frequency contaminant

At \(N=8\) a signal is \(1+0.01T_{16}\). Compare the sampled integral with the exact one and inspect a second grid with 16 intervals.

Work through the solution

Every coarse node samples 1.01, yielding 2.02. The exact integral is

\[2+0.01[2/(1-256)]=1.9999216.\]

The error around 0.0201 is large relative to the true high-mode integral because its samples look constant. At 16 intervals the true mode is represented, giving the exact value up to roundoff. A small-amplitude frequency component can contribute disproportionately to a coarse low-mode estimate when it aliases.

Determine whether an adaptive error diagnostic has a rigorous guarantee

Two nested rules agree to \(10^{-10}\) and all computed high coefficients are small. Does that certify the integral for an otherwise unconstrained analytic function? Construct an explicit counterexample.

Work through the solution

At any fixed finite \(N\), the polynomial \(T_{4N}\) above is analytic and all coarse coefficients except the constant vanish on both grids. Adding a multiple of \(T_{4N}-1\) to an arbitrary candidate leaves both sampled grids unchanged but shifts its exact integral by nearly minus twice that multiple. Thus agreement is evidence conditional on a smoothness or scale model, not an unconditional bound over every analytic function. A genuine analytic error theorem also needs quantitative information such as a bound on an analytic continuation region and its magnitude.

Further reading