LeanFun RevOLVER

2.8 Clenshaw–Curtis quadrature

Integrating the Chebyshev interpolant gives Clenshaw–Curtis quadrature. Its weights and error estimates follow from interpolation, moments and positivity.

2.8.1 Integrating the interpolant

Clenshaw–Curtis quadrature integrates the polynomial reconstructed from the cosine-grid samples. This gives both a coefficient formula and a nodal-weight formula.

Definition 2.8.1 Clenshaw–Curtis quadrature
✓ 🤖

For \(N\ge 1\), define \(\mathcal Q_Nf=\sum _{k=0}^Nc_k(f)m_k\), where \(m_k=\int _{-1}^1T_k\). Separately, set \(\mathcal Q_0f=2f(1)\) for the singleton interpolant.

Reference: [ATAP, Chapter 19].

Lean Formalisation
def Polynomial.Chebyshev.clenshawCurtis (N : ℕ) (f : ℝ → ℝ) : ℝ
Lean definition
/-- For `N>0`, Clenshaw–Curtis quadrature via the finite cosine transform (ATAP 19.2). -/
noncomputable def clenshawCurtis (N : ℕ) (f : ℝ → ℝ) : ℝ :=
  if h : N = 0 then 2 * f 1 else
    ∑ k : Fin (N + 1),
      extremaCoefficient ⟨N, Nat.pos_of_ne_zero h⟩ f k * integralMoment k.val
source

For \(N\ge 1\), \(\mathcal Q_Nf=\int _{-1}^1P_Nf\), and this quadrature is exact for polynomials of degree at most \(N\). If \(f\) is interval integrable and \(|f-P_Nf|\le E\) on \([-1,1]\), its quadrature error is at most \(2E\). If \(\rho {\gt}1\), \(F\) is analytic on the open Bernstein ellipse \(E_\rho \), and \(|F|\le M\) there, then

\[ \left|\int _{-1}^1\Re F(x)\, dx-\mathcal Q_N(\Re F)\right| \le \frac{8M}{\rho ^N(\rho -1)}. \]

Reference: [ATAP, Theorem 19.1 and proof of Theorem 19.3].

Lean Formalisation
theorem Polynomial.Chebyshev.clenshawCurtis_eq_integral_dctInterpolant (N : ℕ) (f : ℝ → ℝ) :
  Polynomial.Chebyshev.clenshawCurtis N f =
    ∫ (x : ℝ) in -1..1, Polynomial.eval x (Polynomial.Chebyshev.dctInterpolant N f)
Lean proof
/-- The coefficient formula integrates precisely the interpolating polynomial. -/
theorem clenshawCurtis_eq_integral_dctInterpolant (N : ℕ) (f : ℝ → ℝ) :
    clenshawCurtis N f = ∫ x in (-1 : ℝ)..1, (dctInterpolant N f).eval x := by
  by_cases hN : N = 0
  · subst N
    norm_num [clenshawCurtis, dctInterpolant, intervalIntegral.integral_const, mul_comm]
  · simp only [clenshawCurtis, dctInterpolant, dite_eq_right hN, eval_finsetSum,
      eval_mul, eval_C]
    rw [intervalIntegral.integral_finsetSum]
    · apply Finset.sum_congr rfl
      intro k _
      rw [intervalIntegral.integral_const_mul, integral_eval_T]
    · intro k _
      exact ((T ℝ (k.val : ℤ)).continuous.const_mul _).intervalIntegrable _ _
source

Positivity and a direct competitor estimate are given in Theorem 2.8.7.

This is the interpolation-derived bound, not the stronger estimate of [ATAP, Theorem 19.3].

The order-zero rule
Theorem 2.8.3 Singleton quadrature
✓ 🤖

The order-zero rule integrates its constant interpolant: \(\mathcal Q_0f=2f(1)\).

Lean Formalisation
theorem Polynomial.Chebyshev.clenshawCurtis_zero (f : ℝ → ℝ) : Polynomial.Chebyshev.clenshawCurtis 0 f = 2 * f 1
Lean proof
/-- The singleton interpolant integrates to twice its sole sample. -/
theorem clenshawCurtis_zero (f : ℝ → ℝ) : clenshawCurtis 0 f = 2 * f 1 := by
  simp [clenshawCurtis]
source

2.8.2 Nodal weights and positivity

The following identity connects the explicit weights to the coefficient-defined rule. Positivity controls the effect of errors in the samples.

Definition 2.8.4 Explicit Clenshaw–Curtis nodal weights
✓ 🤖

For \(N\ge 1\) and \(0\le j\le N\), write \(x_j=\cos (j\pi /N)\), \(d_j=1/2\) at \(j=0,N\) and \(d_j=1\) otherwise, and let \(m_k\) be the classical moment from Definition 2.7.10. Define

\[ w_j=\frac{d_j}{N}\sum _{k=0}^N b_k m_k T_k(x_j),\qquad b_k=\begin{cases} 1& k=0\text{ or }k=N,\\ 2& \text{otherwise}.\end{cases} \]

The nodal endpoints and highest DCT mode have separate half factors.

Reference: [ATAP, Chapters 4 and 19].

Lean Formalisation
def Polynomial.Chebyshev.extremaEndpointWeight (N : { n // 0 < n }) (j : Fin (↑N + 1)) : ℝ
Lean definition
/-- Half factors at the two ends of the extrema index range. -/
noncomputable def extremaEndpointWeight (N : {n : ℕ // 0 < n})
    (j : Fin (N.val + 1)) : ℝ :=
  if j.val = 0 ∨ j.val = N.val then 1 / 2 else 1
source

For \(N\ge 1\) and arbitrary real nodal data, the coefficient-defined rule is \(Q_Nf=\sum _{j=0}^Nw_jf(x_j)\). Each weight is the integral of its Lagrange cardinal polynomial. In the explicit formula, replace \(T_k(x_j)\) by \(\cos (kj\pi /N)\) and \(m_k\) by \(2/(1-k^2)\) for even \(k\) and zero for odd \(k\). Thus the highest term contributes when \(N\) is even and vanishes when \(N\) is odd.

Reference: [ATAP, Chapters 4 and 19].

Lean Formalisation
theorem Polynomial.Chebyshev.extremaSum_eq_sum_endpointWeight (N : { n // 0 < n }) (f : ℕ → ℝ) :
  Polynomial.Chebyshev.extremaSum N f = ∑ j, Polynomial.Chebyshev.extremaEndpointWeight N j * f ↑j
Lean proof
/-- The half-weighted sum as an ordinary finite weighted sum. -/
theorem extremaSum_eq_sum_endpointWeight (N : {n : ℕ // 0 < n}) (f : ℕ → ℝ) :
    extremaSum N f = ∑ j : Fin (N.val + 1), extremaEndpointWeight N j * f j := by
  rcases N with ⟨N, hNp⟩
  have hN : N ≠ 0 := Nat.ne_of_gt hNp
  simp only [extremaEndpointWeight]
  rw [Fin.sum_univ_eq_sum_range (fun j : ℕ => (if j = 0 ∨ j = N then (1 / 2 : ℝ) else 1) * f j)]
  rw [Finset.sum_range_succ]
  have he : ∑ j ∈ Finset.range N, (if j = 0 ∨ j = N then (1 / 2 : ℝ) else 1) * f j =
      (∑ j ∈ Finset.range N, f j) - f 0 / 2 := by
    have hj (j : ℕ) (hj : j ∈ Finset.range N) :
        (if j = 0 ∨ j = N then (1 / 2 : ℝ) else 1) * f j = f j - (if j = 0 then f 0 / 2 else 0) := by
      have hjN : j ≠ N := ne_of_lt (Finset.mem_range.mp hj)
      by_cases hz : j = 0
      · subst j; simp; ring
      · simp [hz, hjN]
    rw [Finset.sum_congr rfl hj, Finset.sum_sub_distrib]
    simp [Nat.pos_of_ne_zero hN]
  rw [he]
  simp only [or_true, ite_true]
  dsimp only [extremaSum]
  ring
source

For \(N\ge 1\), every weight is strictly positive and \(\sum _{j=0}^Nw_j=2\). The endpoint weights agree and are

\[ w_0=w_N=\begin{cases} 1/(N^2-1),& N\text{ even},\\ 1/N^2,& N\text{ odd}. \end{cases} \]

This includes the two-point rule \(N=1\). More generally, \(\sum _{k=0}^Nb_km_kT_k(x){\gt}0\) for \(x\in [-1,1]\).

References: [ATAP, Chapter 19]; [Tre08].

Lean Formalisation
theorem Polynomial.Chebyshev.clenshawCurtis_kernel_pos (N : ℕ) {x : ℝ} (hx : x ∈ Set.Icc (-1) 1) :
  0 <
    ∑ k ∈ Finset.range (N + 1),
      (if k = 0 ∨ k = N then 1 else 2) * Polynomial.Chebyshev.integralMoment k *
        Polynomial.eval x (Polynomial.Chebyshev.T ℝ ↑k)
Lean proof
/-- The cosine kernel defining the weights is strictly positive on [-1,1]. -/
theorem clenshawCurtis_kernel_pos (N : ℕ) {x : ℝ} (hx : x ∈ Set.Icc (-1 : ℝ) 1) :
    0 < ∑ k ∈ Finset.range (N + 1),
      (if k = 0 ∨ k = N then (1 : ℝ) else 2) * integralMoment k * (T ℝ k).eval x := by
  have ht (k : ℕ) : (if k = 0 then (6 : ℝ) else 0) - 2 * |integralMoment k| ≤
      (if k = 0 ∨ k = N then (1 : ℝ) else 2) * integralMoment k * (T ℝ k).eval x := by
    by_cases hk : k = 0
    · subst k; norm_num [integralMoment_eq_ite]
    rw [ite_eq_right hk, zero_sub]
    let a : ℝ := if k = 0 ∨ k = N then 1 else 2
    have ha : 0 ≤ a := by dsimp [a]; split_ifs <;> norm_num
    have ha2 : a ≤ 2 := by dsimp [a]; split_ifs <;> norm_num
    have hab : |a * integralMoment k * (T ℝ k).eval x| ≤ 2 * |integralMoment k| := by
      rw [abs_mul, abs_mul, abs_of_nonneg ha]
      calc
        _ ≤ a * |integralMoment k| := mul_le_of_le_one_right
          (mul_nonneg ha (abs_nonneg _)) (abs_eval_T_real_le_one _ (abs_le.mpr hx))
        _ ≤ _ := mul_le_mul_of_nonneg_right ha2 (abs_nonneg _)
    exact (neg_le_neg hab).trans (neg_abs_le _)
  have hs := Finset.sum_le_sum (fun k (_ : k ∈ Finset.range (N + 1)) ↦ ht k)
  simp only [Finset.sum_sub_distrib, ← Finset.mul_sum] at hs
  simp only [Finset.sum_ite_eq', Finset.mem_range, Nat.zero_lt_succ, ite_true] at hs
  linarith [sum_abs_integralMoment_lt_three N]
source

Example (Julia).

The explicit weight formula uses the unweighted Chebyshev moments. For a positive grid order, the following code computes the weights and displays their positivity, sum and endpoint value.


m(k) = iseven(k) ? 2/(1 - k^2) : 0.0          # integral of T_k
function ccweights(N)
    @assert N >= 1
    [sum((k == 0 || k == N ? 1 : 2)/N *
    (j == 0 || j == N ? 1/2 : 1.0) * cos(k*j*pi/N) * m(k) for k in 0:N)
    for j in 0:N]
end
w = ccweights(8)
(minimum(w) > 0, sum(w), w[1])    # positivity, total weight and endpoint weight

2.8.3 Error estimates and interval scaling

A polynomial competitor bounds the quadrature error. The sharper analytic estimate uses the even coefficient tail.

Theorem 2.8.7 Positive-rule Clenshaw–Curtis error
✓ 🤖

If \(|f(x_j)-g(x_j)|\le \varepsilon \) at all nodes, then \(|Q_Nf-Q_Ng|\le 2\varepsilon \). If \(f\) is interval-integrable and a real polynomial \(p\) of degree at most \(N\) satisfies \(|f(x)-p(x)|\le \varepsilon \) throughout \([-1,1]\), then

\[ \left|\int _{-1}^1f(x)\, dx-Q_Nf\right|\le 4\varepsilon . \]

Here \(N\ge 1\).

Reference: [ATAP, proof of Theorem 19.3].

Lean Formalisation
theorem Polynomial.Chebyshev.abs_clenshawCurtis_sub_le {N : ℕ} (hN : N ≠ 0) {f g : ℝ → ℝ} {ε : ℝ}
  (hfg : ∀ j ≤ N, |f (Polynomial.Chebyshev.node N j) - g (Polynomial.Chebyshev.node N j)| ≤ ε) :
  |Polynomial.Chebyshev.clenshawCurtis N f - Polynomial.Chebyshev.clenshawCurtis N g| ≤ 2 * ε
Lean proof
/-- Nodal perturbations are amplified by at most two. -/
theorem abs_clenshawCurtis_sub_le {N : ℕ} (hN : N ≠ 0) {f g : ℝ → ℝ} {ε : ℝ}
    (hfg : ∀ j ≤ N, |f (node N j) - g (node N j)| ≤ ε) :
    |clenshawCurtis N f - clenshawCurtis N g| ≤ 2 * ε := by
  rw [clenshawCurtis_eq_sum_weights ⟨N, Nat.pos_of_ne_zero hN⟩, clenshawCurtis_eq_sum_weights ⟨N, Nat.pos_of_ne_zero hN⟩,
    ← Finset.sum_sub_distrib]
  simp only [← mul_sub]
  calc
    _ ≤ ∑ j : Fin (N + 1),
        |clenshawCurtisWeight ⟨N, Nat.pos_of_ne_zero hN⟩ j * (f (node N j) - g (node N j))| :=
      Finset.abs_sum_le_sum_abs _ _
    _ ≤ ∑ j : Fin (N + 1), clenshawCurtisWeight ⟨N, Nat.pos_of_ne_zero hN⟩ j * ε := by
      apply Finset.sum_le_sum
      intro j hj
      rw [abs_mul, abs_of_pos (clenshawCurtisWeight_pos ⟨N, Nat.pos_of_ne_zero hN⟩ j)]
      exact mul_le_mul_of_nonneg_left (hfg j (Nat.le_of_lt_succ j.isLt))
        (clenshawCurtisWeight_pos ⟨N, Nat.pos_of_ne_zero hN⟩ j).le
    _ = _ := by rw [← Finset.sum_mul, sum_clenshawCurtisWeight ⟨N, Nat.pos_of_ne_zero hN⟩]
source

Let \(\rho {\gt}1\), let \(F\) be analytic on the open Bernstein ellipse \(E_\rho \), and suppose \(|F(z)|\le M\) there. For \(N\ge 2\),

\[ \left|\int _{-1}^1\Re F(x)\, dx-Q_N(\Re F)\right| \le \frac{64M}{15\rho ^{N-1}(\rho ^2-1)}. \]

If \(N\) is even, replace \(\rho ^{N-1}\) by \(\rho ^N\). More generally, any \(1\le m\) with \(2m\le N\) gives the denominator \(15\rho ^{2m}(\rho ^2-1)\). The underlying series bound uses \(|a_k|\le Cq^k\), \(0\le q{\lt}1\), to give \(\frac{32}{15}Cq^{2(m+1)}/(1-q^2)\).

Reference: [ATAP, Theorem 19.3, equation (19.7)].

Lean Formalisation
theorem Polynomial.Chebyshev.tsum_even_tail_le_geometric {a : ℕ → ℝ} {C q : ℝ} (hq : 0 ≤ q) (hq1 : q < 1)
  (ha : ∀ (k : ℕ), |a k| ≤ C * q ^ k) (m : ℕ) :
  ∑' (k : ℕ), |a (2 * (k + (m + 1)))| ≤ C * q ^ (2 * (m + 1)) / (1 - q ^ 2)
Lean proof
/-- A geometric majorant summed over even frequencies beyond `2m`. -/
theorem tsum_even_tail_le_geometric {a : ℕ → ℝ} {C q : ℝ}
    (hq : 0 ≤ q) (hq1 : q < 1) (ha : ∀ k, |a k| ≤ C * q ^ k) (m : ℕ) :
    (∑' k, |a (2 * (k + (m + 1)))|) ≤ C * q ^ (2 * (m + 1)) / (1 - q ^ 2) := by
  have hq2 : q ^ 2 < 1 := by nlinarith
  have hb (k : ℕ) : |a (2 * k)| ≤ C * (q ^ 2) ^ k := by
    simpa only [← pow_mul] using ha (2 * k)
  simpa only [← pow_mul] using
    tsum_tail_le_geometric (sq_nonneg q) hq2 (fun k ↦ abs_nonneg (a (2 * k))) hb (m + 1)
source

For \(a{\lt}b\) and \(N\ge 1\), \(P_N(f\circ A)\circ B\) interpolates \(f\) at the mapped extrema \(A(x_j)\). Its integral is the scaled rule \(\frac{b-a}{2}\mathcal Q_N(f\circ A)\), which is exact for every physical polynomial of degree at most \(N\). If \(f\circ A\) is interval integrable and its canonical interpolation error is at most \(E\) on \([-1,1]\), the physical quadrature error is at most \((b-a)E\). In particular, let \(\rho {\gt}1\), let \(F\) be analytic on the open ellipse \(E_\rho \), and let \(|F|\le M\) there. For \(f(x)=\Re F(B(x))\) the error is at most

\[ \frac{4(b-a)M}{\rho ^N(\rho -1)}. \]

Reference: [ATAP, Chapters 8 and 19], with affine scaling.

Lean Formalisation
theorem Polynomial.Chebyshev.eval_dctInterpolant_interval_node {a b : ℝ} (hab : a < b) {N : ℕ} (hN : N ≠ 0) (f : ℝ → ℝ) {j : ℕ}
  (hj : j ≤ N) :
  Polynomial.eval
      (Polynomial.Chebyshev.intervalCoord a ⟨b, ⋯⟩
        (Polynomial.Chebyshev.intervalMap a b (Polynomial.Chebyshev.node N j)))
      (Polynomial.Chebyshev.dctInterpolant N fun t => f (Polynomial.Chebyshev.intervalMap a b t)) =
    f (Polynomial.Chebyshev.intervalMap a b (Polynomial.Chebyshev.node N j))
Lean proof
/-- The DCT polynomial pulled back to `[a,b]` matches all the mapped extrema. -/
theorem eval_dctInterpolant_interval_node {a b : ℝ} (hab : a < b)
    {N : ℕ} (hN : N ≠ 0) (f : ℝ → ℝ) {j : ℕ} (hj : j ≤ N) :
    (dctInterpolant N (fun t ↦ f (intervalMap a b t))).eval
      (intervalCoord a ⟨b, ne_of_lt hab⟩ (intervalMap a b (node N j))) = f (intervalMap a b (node N j)) := by
  rw [intervalCoord_intervalMap hab]
  exact eval_dctInterpolant_node hN _ hj
source
Even tails, moment sums and aliasing

Suppose \(\sum _{k\ge 0}|a_k|{\lt}\infty \) and \(f(x)=\sum _{k\ge 0}a_kT_k(x)\) on \([-1,1]\). Integration and quadrature commute with this series. If \(N\ge 1\) and \(2m\le N\), then the error has the absolutely convergent expansion

\[ \int _{-1}^1 f-Q_Nf =\sum _{j\ge 0} a_{2(j+m+1)}\bigl(m_{2(j+m+1)}-Q_NT_{2(j+m+1)}\bigr). \]

If also \(m\ge 1\), its absolute value is at most \(\frac{32}{15}\sum _{j\ge 0}|a_{2(j+m+1)}|\).

Reference: [ATAP, proof of Theorem 19.3].

Lean Formalisation
theorem Polynomial.Chebyshev.hasSum_integralMoment {a : ℕ → ℝ} {f : ℝ → ℝ} (ha : Summable fun k => |a k|)
  (hf : ∀ x ∈ Set.Icc (-1) 1, HasSum (fun k => a k * Polynomial.eval x (Polynomial.Chebyshev.T ℝ ↑k)) (f x)) :
  HasSum (fun k => a k * Polynomial.Chebyshev.integralMoment k) (∫ (x : ℝ) in -1..1, f x)
Lean proof
/-- Absolute coefficient summability permits integration of a Chebyshev series. -/
theorem hasSum_integralMoment {a : ℕ → ℝ} {f : ℝ → ℝ}
    (ha : Summable (fun k ↦ |a k|))
    (hf : ∀ x ∈ Icc (-1 : ℝ) 1,
      HasSum (fun k : ℕ ↦ a k * (T ℝ k).eval x) (f x)) :
    HasSum (fun k ↦ a k * integralMoment k) (∫ x in (-1 : ℝ)..1, f x) := by
  have h := intervalIntegral.hasSum_integral_of_dominated_convergence
    (a := (-1 : ℝ)) (b := 1) (μ := volume)
    (F := fun k x ↦ a k * (T ℝ k).eval x) (f := f) (fun k _ ↦ |a k|)
    (fun k ↦ (continuous_const.mul (T ℝ k).continuous).aestronglyMeasurable)
    (fun k ↦ Filter.Eventually.of_forall fun x hx ↦ by
      have hx' : x ∈ Icc (-1 : ℝ) 1 := by
        simpa only [uIcc_of_le (by norm_num : (-1 : ℝ) ≤ 1)] using uIoc_subset_uIcc hx
      rw [Real.norm_eq_abs, abs_mul]
      exact mul_le_of_le_one_right (abs_nonneg _) (abs_eval_T_real_le_one _ (abs_le.mpr hx')))
    (Filter.Eventually.of_forall fun _ _ ↦ ha) intervalIntegrable_const
    (Filter.Eventually.of_forall fun x hx ↦ hf x (by
      simpa only [uIcc_of_le (by norm_num : (-1 : ℝ) ≤ 1)] using uIoc_subset_uIcc hx))
  simpa only [intervalIntegral.integral_const_mul, ← integralMoment_eq_integral] using h
source

The odd moments vanish, and every positive-degree moment is nonpositive. For every \(m\ge 0\),

\[ \sum _{k=0}^{2m}|m_k|=3-\frac1{2m+1},\qquad \sum _{k=0}^Nm_k=4-\sum _{k=0}^N|m_k|. \]

In particular, every finite absolute moment sum is strictly below \(3\). For \(N\ge 1\), the endpoint-mode sum satisfies \(\sum _{k=0}^Nb_km_k=2\sum _{k=0}^Nm_k-2-m_N\).

Reference: [ATAP, equation (19.6)].

Lean Formalisation
theorem Polynomial.Chebyshev.integralMoment_odd (k : ℕ) : Polynomial.Chebyshev.integralMoment (2 * k + 1) = 0
Lean proof
/-- Odd modes have zero moment. -/
@[simp] theorem integralMoment_odd (k : ℕ) : integralMoment (2 * k + 1) = 0 := by
  rw [integralMoment_eq_ite, ite_eq_right (Nat.not_even_iff_odd.mpr ⟨k,rfl⟩)]
source

For \(N\ge 1\), the folded index \(A_N(k)\) has the same parity as \(k\), and \(Q_NT_k=m_{A_N(k)}\). In particular, \(Q_NT_{2k+1}=0\) for every \(k\ge 0\), even beyond the polynomial exactness degree.

Reference: [ATAP, Chapters 4 and 19].

Lean Formalisation
theorem Polynomial.Chebyshev.aliasIndex_mod_two {N : ℕ} (hN : N ≠ 0) (k : ℕ) : Polynomial.Chebyshev.aliasIndex N k % 2 = k % 2
Lean proof
/-- Folding a frequency at the extrema preserves its parity (ATAP, Chapter 4). -/
theorem aliasIndex_mod_two {N : ℕ} (hN : N ≠ 0) (k : ℕ) :
    aliasIndex N k % 2 = k % 2 := by
  have hm := Nat.mod_lt k (show 0 < 2 * N by omega)
  have hp : (k % (2 * N)) % 2 = k % 2 :=
    Nat.mod_mod_of_dvd k (dvd_mul_right 2 N)
  simp only [aliasIndex, ite_eq_right hN]
  rcases le_total (k % (2 * N)) (2 * N - k % (2 * N)) with h | h
  · rw [min_eq_left h]
    exact hp
  · rw [min_eq_right h]
    omega
source

For \(N\ge 1\) and every \(k\ge 0\), \(|Q_NT_k|\le 2\). For \(k\ge 4\), \(|m_k|\le 2/15\), and hence \(|m_k-Q_NT_k|\le 32/15\).

Reference: [ATAP, proof of Theorem 19.3].

Lean Formalisation
theorem Polynomial.Chebyshev.abs_clenshawCurtis_eval_T_le_two {N : ℕ} (hN : N ≠ 0) (k : ℕ) :
  |Polynomial.Chebyshev.clenshawCurtis N fun x => Polynomial.eval x (Polynomial.Chebyshev.T ℝ ↑k)| ≤ 2
Lean proof
/-- Positive weights of total mass two bound the quadrature of every mode. -/
theorem abs_clenshawCurtis_eval_T_le_two {N : ℕ} (hN : N ≠ 0) (k : ℕ) :
    |clenshawCurtis N (fun x ↦ (T ℝ k).eval x)| ≤ 2 := by
  have h := abs_clenshawCurtis_sub_le hN (f := fun x ↦ (T ℝ k).eval x)
    (g := fun _ ↦ 0) (ε := 1) (fun j _ ↦ by
      simpa using abs_eval_T_real_le_one (k : ℤ) (abs_le.mpr (node_mem_Icc (n := N) (i := j))))
  simpa [clenshawCurtis_eq_sum_weights ⟨N, Nat.pos_of_ne_zero hN⟩] using h
source