archimedes.quadrature.clenshaw_curtisยถ

archimedes.quadrature.clenshaw_curtis(
n: int,
a: float | None = None,
b: float | None = None,
) → QuadratureRuleยถ

Clenshaw-Curtis quadrature rule with n nodes.

Nodes are the extrema of the degree-\((n-1)\) Chebyshev polynomial \(T_{n-1}(x)\) (the Chebyshev-Lobatto points), including both endpoints \(\pm 1\):

\[x_k = \cos(k \pi / (n - 1)), \quad k = 0, \ldots, n - 1.\]

Unlike Gauss quadrature, these nodes are not chosen to maximize polynomial exactness โ€“ the rule is only guaranteed exact for polynomials up to degree \(n - 1\), half that of Gauss-Legendre for the same node count. The weight function is still uniform, so this rule shares the Legendre measure with gauss_legendre, gauss_radau, and gauss_lobatto, and can be tiled with composite_quad. The tradeoff for the lower degree of exactness is that Chebyshev-Lobatto nodes are nested across doublings of n and cheap, numerically stable to compute for very large n.

Weights are computed via a \(O(n \log n)\) algorithm from Waldvogel [1], which expresses them as the inverse DFT of an explicit, rational moment vector.

Parameters:
  • n (int) โ€“ Number of quadrature nodes.

  • a (float, optional) โ€“ Bounds of the target interval. Must both be given, or neither. Defaults to \([-1, 1]\).

  • b (float, optional) โ€“ Bounds of the target interval. Must both be given, or neither. Defaults to \([-1, 1]\).

Returns:

rule โ€“ Clenshaw-Curtis rule with n nodes on \([-1, 1]\), exact to degree \(n - 1\), mapped onto \([a, b]\) if given.

Return type:

QuadratureRule

Raises:

ValueError โ€“ If n < 2.

References