Clenshaw Algorithm
Clenshaw算法是一种可以高效、稳定地计算在某族正交多项式基底下展开的函数逼近值的递归方法。具体来说,对于一个形式为
的
其中
Clenshaw的关键思想是注意到递推式
上式可被简记为
其中
注意到
实际上,Clenshaw算法也可以被看作是单项式基下的秦九韶算法(Horner方法)在正交多项式基底下的推广:对于单项式基底,递推关系为
此时上面介绍的Clenshaw算法退化为秦九韶算法:
Benchmark
下图展示了Clenshaw算法在Chebyshev基底下计算
Benchmark of Clenshaw Algorithm
Code: MATLAB code for benchmarking Clenshaw's algorithm.
1 | nn = round(logspace(1,5,50)); |
Remarks
当仅需要计算展开式在少量点处的值时,Clenshaw算法是最常用且几乎总是高效的数值方法。但在一些特殊情况下,可能存在更快的算法,例如
- 在Chebyshev基底下要计算
阶逼近在全部的 个Chebyshev点处的值时,应当使用FFT-based的快速Chebyshev变换算法,其复杂度为 ,与之对比Clenshaw算法的复杂度为 。 - 在Legendre基底下要计算
阶逼近在全部的 个Gauss-Legendre点处的值时,应当使用专门的快速Legendre变换算法([1][2][3]),其复杂度为 ,与之对比Clenshaw算法的复杂度为 。 - 对于更一般的Jacobi多项式基底下的展开,在全部的
个Gauss-Jacobi点处计算值时,也存在类似的快速变换算法[4],但是通常具有较大的常数系数,这使得在通常规模问题下Clenshaw算法仍然更为高效,仅在超大规模问题下才会被快速算法超越,并且此类快速算法的误差一般更大。 - 当求值点并非经典的正交多项式节点时,可以尝试NUFFT等方法加速求值过程[5],例如Faster chebtech restrict中讨论了如何使用NUFFT加速计算Chebyshev展开在等距点上的取值,当阶数
时,快速算法才会优于Clenshaw算法,并且附带误差增长为 。
See Clenshaw Algorithm on Wikipedia for more details.
Code: MATLAB code for Chebyshev based Clenshaw's algorithm in Chebfun.
1 | function y = clenshaw(x, c) |
References
- Hale N, Townsend A. A fast FFT-based discrete Legendre transform. IMA.NA, 2016, 36(4): 1670-1684.
- Hale N, Townsend A. A fast, simple, and stable Chebyshev–Legendre transform using an asymptotic formula. SISC, 2014, 36(1): A148-A167.
- Townsend A, Webb M, Olver S. Fast polynomial transforms based on Toeplitz and Hankel matrices. Math.Comp, 2018, 87(312): 1913-1934.
- Shen J, Wang Y, Xia J. Fast structured Jacobi-Jacobi transforms. Math.Comp, 2019, 88(318): 1743-1772.
- Ruiz-Antolin D, Townsend A. A nonuniform fast Fourier transform based on low rank approximation. SISC, 2018, 40(1): A529-A547.
- Title: Clenshaw Algorithm
- Author: Gypsophila
- Created at : 2026-01-28 00:00:00
- Updated at : 2026-01-29 14:03:02
- Link: https://chenx.space/2026/01/28/Clenshaw/
- License: This work is licensed under CC BY-NC-SA 4.0.
Comments