Clenshaw algorithm

From testwiki
Jump to navigation Jump to search

In numerical analysis, the Clenshaw algorithm, also called Clenshaw summation, is a recursive method to evaluate a linear combination of Chebyshev polynomials.[1][2] The method was published by Charles William Clenshaw in 1955. It is a generalization of Horner's method for evaluating a linear combination of monomials.

It generalizes to more than just Chebyshev polynomials; it applies to any class of functions that can be defined by a three-term recurrence relation.[3]

Clenshaw algorithm

In full generality, the Clenshaw algorithm computes the weighted sum of a finite series of functions ϕk(x): S(x)=k=0nakϕk(x) where ϕk,k=0,1, is a sequence of functions that satisfy the linear recurrence relation ϕk+1(x)=αk(x)ϕk(x)+βk(x)ϕk1(x), where the coefficients αk(x) and βk(x) are known in advance.

The algorithm is most useful when ϕk(x) are functions that are complicated to compute directly, but αk(x) and βk(x) are particularly simple. In the most common applications, α(x) does not depend on k, and β is a constant that depends on neither x nor k.

To perform the summation for given series of coefficients a0,,an, compute the values bk(x) by the "reverse" recurrence formula: bn+1(x)=bn+2(x)=0,bk(x)=ak+αk(x)bk+1(x)+βk+1(x)bk+2(x).

Note that this computation makes no direct reference to the functions ϕk(x). After computing b2(x) and b1(x), the desired sum can be expressed in terms of them and the simplest functions ϕ0(x) and ϕ1(x): S(x)=ϕ0(x)a0+ϕ1(x)b1(x)+β1(x)ϕ0(x)b2(x).

See Fox and Parker[4] for more information and stability analyses.

Examples

Horner as a special case of Clenshaw

A particularly simple case occurs when evaluating a polynomial of the form S(x)=k=0nakxk. The functions are simply ϕ0(x)=1,ϕk(x)=xk=xϕk1(x) and are produced by the recurrence coefficients α(x)=x and β=0.

In this case, the recurrence formula to compute the sum is bk(x)=ak+xbk+1(x) and, in this case, the sum is simply S(x)=a0+xb1(x)=b0(x), which is exactly the usual Horner's method.

Special case for Chebyshev series

Consider a truncated Chebyshev series pn(x)=a0+a1T1(x)+a2T2(x)++anTn(x).

The coefficients in the recursion relation for the Chebyshev polynomials are α(x)=2x,β=1, with the initial conditions T0(x)=1,T1(x)=x.

Thus, the recurrence is bk(x)=ak+2xbk+1(x)bk+2(x) and the final sum is pn(x)=a0+xb1(x)b2(x).

One way to evaluate this is to continue the recurrence one more step, and compute b0(x)=a0+2xb1(x)b2(x), (note the doubled a0 coefficient) followed by pn(x)=12[a0+b0(x)b2(x)].

Meridian arc length on the ellipsoid

Clenshaw summation is extensively used in geodetic applications.[2] A simple application is summing the trigonometric series to compute the meridian arc distance on the surface of an ellipsoid. These have the form m(θ)=C0θ+C1sinθ+C2sin2θ++Cnsinnθ.

Leaving off the initial C0θ term, the remainder is a summation of the appropriate form. There is no leading term because ϕ0(θ)=sin0θ=sin0=0.

The recurrence relation for sinkθ is sin(k+1)θ=2cosθsinkθsin(k1)θ, making the coefficients in the recursion relation αk(θ)=2cosθ,βk=1. and the evaluation of the series is given by bn+1(θ)=bn+2(θ)=0,bk(θ)=Ck+2cosθbk+1(θ)bk+2(θ),for nk1. The final step is made particularly simple because ϕ0(θ)=sin0=0, so the end of the recurrence is simply b1(θ)sin(θ); the C0θ term is added separately: m(θ)=C0θ+b1(θ)sinθ.

Note that the algorithm requires only the evaluation of two trigonometric quantities cosθ and sinθ.

Difference in meridian arc lengths

Sometimes it necessary to compute the difference of two meridian arcs in a way that maintains high relative accuracy. This is accomplished by using trigonometric identities to write m(θ1)m(θ2)=C0(θ1θ2)+k=1n2Cksin(12k(θ1θ2))cos(12k(θ1+θ2)). Clenshaw summation can be applied in this case[5] provided we simultaneously compute m(θ1)+m(θ2) and perform a matrix summation, 𝖬(θ1,θ2)=[(m(θ1)+m(θ2))/2(m(θ1)m(θ2))/(θ1θ2)]=C0[μ1]+k=1nCk𝖥k(θ1,θ2), where δ=12(θ1θ2),μ=12(θ1+θ2),𝖥k(θ1,θ2)=[coskδsinkμsinkδδcoskμ]. The first element of 𝖬(θ1,θ2) is the average value of m and the second element is the average slope. 𝖥k(θ1,θ2) satisfies the recurrence relation 𝖥k+1(θ1,θ2)=𝖠(θ1,θ2)𝖥k(θ1,θ2)𝖥k1(θ1,θ2), where 𝖠(θ1,θ2)=2[cosδcosμδsinδsinμsinδδsinμcosδcosμ] takes the place of α in the recurrence relation, and β=1. The standard Clenshaw algorithm can now be applied to yield 𝖡n+1=𝖡n+2=𝟢,𝖡k=Ck𝖨+𝖠𝖡k+1𝖡k+2,for nk1,𝖬(θ1,θ2)=C0[μ1]+𝖡1𝖥1(θ1,θ2), where 𝖡k are 2×2 matrices. Finally we have m(θ1)m(θ2)θ1θ2=𝖬2(θ1,θ2). This technique can be used in the limit θ2=θ1=μ and δ=0 to simultaneously compute m(μ) and the derivative dm(μ)/dμ, provided that, in evaluating 𝖥1 and 𝖠, we take limδ0(sinkδ)/δ=k.

See also

References

Template:Reflist

  1. Template:Cite journal Note that this paper is written in terms of the Shifted Chebyshev polynomials of the first kind Tn*(x)=Tn(2x1).
  2. 2.0 2.1 Template:Citation
  3. Template:Citation
  4. Template:Citation
  5. Template:Cite journal