archimedes.quadrature.clenshaw_curtisยถ
- archimedes.quadrature.clenshaw_curtis(
- n: int,
- a: float | None = None,
- b: float | None = None,
Clenshaw-Curtis quadrature rule with
nnodes.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, andgauss_lobatto, and can be tiled withcomposite_quad. The tradeoff for the lower degree of exactness is that Chebyshev-Lobatto nodes are nested across doublings ofnand cheap, numerically stable to compute for very largen.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
nnodes on \([-1, 1]\), exact to degree \(n - 1\), mapped onto \([a, b]\) if given.- Return type:
- Raises:
ValueError โ If
n < 2.
References