a fast chebyshev–legendre transform using an asymptotic formula
TRANSCRIPT
A fast Chebyshev–Legendre transform usingan asymptotic formula
Alex TownsendMIT
(Joint work with Nick Hale)
SIAM OPSFA, 5th June 2015
IntroductionWhat is the Chebyshev–Legendre transform?
Suppose we have a degree N ´ 1 polynomial. It can be expressed in theChebyshev or Legendre polynomial basis:
pN´1pxq “N´1ÿ
k“0
c legk Pk pxq ðñ pN´1pxq “
N´1ÿ
k“0
cchebk Tk pxq
The Chebyshev–Legendre transform:forward transform
ÝÝÝÝÝÝÝÝÝÝÝÝÝÝá
c leg0 , . . . , c leg
N´1 OpNplog Nq2{ log log Nq ccheb0 , . . . , ccheb
N´1 .âÝÝÝÝÝÝÝÝÝÝÝÝÝ
inverse transform
Applications in:I Convolution [Hale & T., 14]I Legendre-tau spectral methodsI QR of a quasimatrix [Trefethen, 08]I best least squares approximation
Alex Townsend @ MIT 1/18
IntroductionWhat is the Chebyshev–Legendre transform?
Suppose we have a degree N ´ 1 polynomial. It can be expressed in theChebyshev or Legendre polynomial basis:
pN´1pxq “N´1ÿ
k“0
c legk Pk pxq ðñ pN´1pxq “
N´1ÿ
k“0
cchebk Tk pxq
The Chebyshev–Legendre transform:forward transform
ÝÝÝÝÝÝÝÝÝÝÝÝÝÝá
c leg0 , . . . , c leg
N´1 OpNplog Nq2{ log log Nq ccheb0 , . . . , ccheb
N´1 .âÝÝÝÝÝÝÝÝÝÝÝÝÝ
inverse transform
Applications in:I Convolution [Hale & T., 14]I Legendre-tau spectral methodsI QR of a quasimatrix [Trefethen, 08]I best least squares approximation
Alex Townsend @ MIT 1/18
IntroductionWhat is the Chebyshev–Legendre transform?
Suppose we have a degree N ´ 1 polynomial. It can be expressed in theChebyshev or Legendre polynomial basis:
pN´1pxq “N´1ÿ
k“0
c legk Pk pxq ðñ pN´1pxq “
N´1ÿ
k“0
cchebk Tk pxq
The Chebyshev–Legendre transform:forward transform
ÝÝÝÝÝÝÝÝÝÝÝÝÝÝá
c leg0 , . . . , c leg
N´1 OpNplog Nq2{ log log Nq ccheb0 , . . . , ccheb
N´1 .âÝÝÝÝÝÝÝÝÝÝÝÝÝ
inverse transform
Applications in:I Convolution [Hale & T., 14]I Legendre-tau spectral methodsI QR of a quasimatrix [Trefethen, 08]I best least squares approximation
Alex Townsend @ MIT 1/18
IntroductionRelated work
Values atChebyshev
points
Legendrecoefficients
Chebyshevcoefficients
Values inthe complex
plane
Values atLegendre
points
Potts et al.O`
Nplog Nq2˘
Mori et al.O pN log Nq
Alpert & Rokhlin
O pNq
discrete cosine transform
O pN log Nq
IserlesO pN log Nq
TygertO`
Nplog Nq2˘
New features of our algorithmsFFT-based approachAnalysis-basedNo precomputation
Alex Townsend @ MIT 2/18
IntroductionThe fast Fourier transform
The FFT computes the DFT in OpN log Nq operations:
Xk “řN´1
n“0 xn ¨ e´2πink{N, 0 ď k ď N ´ 1.Top 10
algorithm
James Cooley;
sinp´2πtqe´2πit
cosp´2πtqReal axis
Imag
axis
t
John Tukey;
Alex Townsend @ MIT 3/18
IntroductionMany special functions are trigonometric-like
Trigonometric functionscospωxq, sinpωxq
Chebyshev polynomialsTnpxq
Legendre polynomialsPnpxq
Bessel functionsJνpzq
Airy functionsAipxq
Also, Jacobi polynomials, Hermite polynomials, cylinder functions, etc.
Alex Townsend @ MIT 4/18
IntroductionMany special functions are trigonometric-like
Trigonometric functionscospωxq, sinpωxq
Chebyshev polynomialsTnpxq
Legendre polynomialsPnpxq
Bessel functionsJνpzq
Airy functionsAipxq
Also, Jacobi polynomials, Hermite polynomials, cylinder functions, etc.
Alex Townsend @ MIT 4/18
IntroductionMany special functions are trigonometric-like
Trigonometric functionscospωxq, sinpωxq
Chebyshev polynomialsTnpxq
Legendre polynomialsPnpxq
Bessel functionsJνpzq
Airy functionsAipxq
Also, Jacobi polynomials, Hermite polynomials, cylinder functions, etc.
Alex Townsend @ MIT 4/18
IntroductionMany special functions are trigonometric-like
Trigonometric functionscospωxq, sinpωxq
Chebyshev polynomialsTnpxq
Legendre polynomialsPnpxq
Bessel functionsJνpzq
Airy functionsAipxq
Also, Jacobi polynomials, Hermite polynomials, cylinder functions, etc.
Alex Townsend @ MIT 4/18
IntroductionMany special functions are trigonometric-like
Trigonometric functionscospωxq, sinpωxq
Chebyshev polynomialsTnpxq
Legendre polynomialsPnpxq
Bessel functionsJνpzq
Airy functionsAipxq
Also, Jacobi polynomials, Hermite polynomials, cylinder functions, etc.
Alex Townsend @ MIT 4/18
IntroductionMany special functions are trigonometric-like
Trigonometric functionscospωxq, sinpωxq
Chebyshev polynomialsTnpxq
Legendre polynomialsPnpxq
Bessel functionsJνpzq
Airy functionsAipxq
Also, Jacobi polynomials, Hermite polynomials, cylinder functions, etc.
Alex Townsend @ MIT 4/18
IntroductionAn asymptotic expansion of Legendre polynomials
Legendre polynomials
Pnpcosθq “ Cn
M´1ÿ
m“0
hm,ncos
`
pm ` n ` 12qθ ´ pm `
12qπ2
˘
p2 sinθqm`1{2`Rn,Mpθq
Cn “
c
4π
Γpn ` 1qΓpn ` 3{2q
, hm,n “
#
1, m “ 0,śm
j“1pj´1{2q2
jpn`j`1{2q , m ą 0. Thomas Stieltjes
Interior Region: Trig−like
Boundary Region: Bessel−like
cos(5π/6) cos(π/6)Alex Townsend @ MIT 5/18
IntroductionNumerical pitfalls of an asymptotic expansionist
Pnpcosθq “ Cn
M´1ÿ
m“0
hm,ncos
`
pm ` n ` 12qθ ´ pm `
12qπ2
˘
p2 sinθqm`1{2` Rn,Mpθq
M “ 1
M “ 3
M “ 5,7
n “ 1,000
x
|Rn,
Mpθq|
Fix M. Where is the asymptotic expansion accurate?Alex Townsend @ MIT 6/18
Computing the Chebyshev–Legendre transformThe transform comes in two parts
The Chebyshev–Legendre transform naturally splits into two parts:
This bitÝÝÝÝÝÝÝá
IDCTÝÝÝÝÝÝá
c leg0 , . . . , c leg
N´1 pN´1pxcheb0 q, . . . ,pN´1pxcheb
N´1 q ccheb0 , . . . , ccheb
N´1âÝÝÝÝÝÝÝ
DCTâÝÝÝÝÝÝ
Task: Compute the following matrix-vector product in quasilinear time?
PNc “
¨
˚
˚
˝
P0pcosθ0q . . . PN´1pcosθ0q
.... . .
...
P0pcosθN´1q . . . PN´1pcosθN´1q
˛
‹
‹
‚
¨
˚
˚
˚
˝
c leg0...
c legN´1
˛
‹
‹
‹
‚
, θk “kπ
N ´ 1
Alex Townsend @ MIT 7/18
Computing the Chebyshev–Legendre transformThe transform comes in two parts
The Chebyshev–Legendre transform naturally splits into two parts:
This bitÝÝÝÝÝÝÝá
IDCTÝÝÝÝÝÝá
c leg0 , . . . , c leg
N´1 pN´1pxcheb0 q, . . . ,pN´1pxcheb
N´1 q ccheb0 , . . . , ccheb
N´1âÝÝÝÝÝÝÝ
DCTâÝÝÝÝÝÝ
Task: Compute the following matrix-vector product in quasilinear time?
PNc “
¨
˚
˚
˝
P0pcosθ0q . . . PN´1pcosθ0q
.... . .
...
P0pcosθN´1q . . . PN´1pcosθN´1q
˛
‹
‹
‚
¨
˚
˚
˚
˝
c leg0...
c legN´1
˛
‹
‹
‹
‚
, θk “kπ
N ´ 1
Alex Townsend @ MIT 7/18
Computing the Chebyshev–Legendre transformAsymptotic expansions as a matrix decomposition
The asymptotic expansion
Pnpcosθk q “ Cn
M´1ÿ
m“0
hm,ncos
`
pm ` n ` 12qθk ´ pm `
12qπ2
˘
p2 sinθk qm`1{2
` Rn,Mpθk q
gives a matrix decomposition (sum of diagonally scaled DCTs and DSTs):
PN “
M´1ÿ
m“0
¨
˝DumCNDChm ` Dvm
»
–
0 0 00 SN´2 00 0 0
fi
flDChm
˛
‚` RN,M.
“ `PN PASYN RN,M
Alex Townsend @ MIT 8/18
Computing the Chebyshev–Legendre transformAsymptotic expansions as a matrix decomposition
The asymptotic expansion
Pnpcosθk q “ Cn
M´1ÿ
m“0
hm,ncos
`
pm ` n ` 12qθk ´ pm `
12qπ2
˘
p2 sinθk qm`1{2
` Rn,Mpθk q
gives a matrix decomposition (sum of diagonally scaled DCTs and DSTs):
PN “
M´1ÿ
m“0
¨
˝DumCNDChm ` Dvm
»
–
0 0 00 SN´2 00 0 0
fi
flDChm
˛
‚` RN,M.
“ `PN PASYN RN,M
Alex Townsend @ MIT 8/18
Computing the Chebyshev–Legendre transformAsymptotic expansions as a matrix decomposition
The asymptotic expansion
Pnpcosθk q “ Cn
M´1ÿ
m“0
hm,ncos
`
pm ` n ` 12qθk ´ pm `
12qπ2
˘
p2 sinθk qm`1{2
` Rn,Mpθk q
gives a matrix decomposition (sum of diagonally scaled DCTs and DSTs):
PN “
M´1ÿ
m“0
¨
˝DumCNDChm ` Dvm
»
–
0 0 00 SN´2 00 0 0
fi
flDChm
˛
‚` RN,M.
“ `PN PASYN RN,M
Alex Townsend @ MIT 8/18
Computing the Chebyshev–Legendre transformBe careful and stay safe
Error curve: |Rn,Mpθk q| “ ε
RN,M “
M“15M“7
M“ 6
M“5
|Rn,Mpθk q| ď2CnhM,n
p2 sinθk qM`1{2
Fix M. Where is the asymptotic expan-sion accurate?
Alex Townsend @ MIT 9/18
Computing the Chebyshev–Legendre transformPartitioning and balancing competing costs
PN “ P(1)NP(2)
NP(3)N
PEVALN
αNα2Nα3N N
TheoremThe matrix-vector product f “ PNc canbe computed in OpNplog Nq2{ loglog Nqoperations.
PEVALN c
P(j)N c
OpN2q
OpN log Nq
α too small
Alex Townsend @ MIT 10/18
Computing the Chebyshev–Legendre transformPartitioning and balancing competing costs
PN “ P(1)NP(2)
NP(3)N
PEVALN
αNα2Nα3N N
TheoremThe matrix-vector product f “ PNc canbe computed in OpNplog Nq2{ loglog Nqoperations.
PEVALN c
P(j)N c
OpN2q
OpN log Nq
α too small
Alex Townsend @ MIT 10/18
Computing the Chebyshev–Legendre transformPartitioning and balancing competing costs
PN “ P(1)NP(2)
NP(3)N
PEVALN
αNα2Nα3N N
TheoremThe matrix-vector product f “ PNc canbe computed in OpNplog Nq2{ loglog Nqoperations.
PEVALN c
P(j)N c
OpN2q
OpN log Nq
α too small
Alex Townsend @ MIT 10/18
Computing the Chebyshev–Legendre transformPartitioning and balancing competing costs
PN “ P(1)NP(2)
NP(3)N
PEVALN
αNα2Nα3N N
TheoremThe matrix-vector product f “ PNc canbe computed in OpNplog Nq2{ loglog Nqoperations.
PEVALN c
P(j)N c
OpN log Nq
OpN2 log Nq
α too large
Alex Townsend @ MIT 11/18
Computing the Chebyshev–Legendre transformPartitioning and balancing competing costs
PN “ P(1)NP(2)
NP(3)N
PEVALN
αNα2Nα3N N
TheoremThe matrix-vector product f “ PNc canbe computed in OpNplog Nq2{ loglog Nqoperations.
PEVALN cP(j)
N c
OpNplog Nq2{ loglog NqOpNplog Nq2{ loglog Nq
α “ Op1{ log Nq
Alex Townsend @ MIT 12/18
Computing the Chebyshev–Legendre transformNumerical results
OpN
2 q
OpNp
log Nq2 { lo
glog Nq
No precomputation.
Mollification of rough signals
ż 1
´1Pnpxqe´iωxdx “ im
d
2π´ω
Jm`1{2p´ωq
Alex Townsend @ MIT 13/18
Computing the Chebyshev–Legendre transformThe inverse Chebyshev–Legendre transform
The integral formula for Legendre coefficients gives the following relation:
c legN “
“
IN`1 |0N‰
Ds2NP2Npxcheb
2N qTDw2N
T2Npxcheb2N q
„
IN`10N
cchebN ,
PEVAL2N
T
P(1)2N
T
P(2)2N
T
P(3)2N
T
2αN
2α2N2α3N
2N
i11 i12 i13
P2Npxcheb2N qT
OpN
2 q
OpNp
log Nq2 { lo
glog Nq
N
Exe
cutio
ntim
e
Alex Townsend @ MIT 14/18
Future workFast spherical harmonic transform
Spherical harmonic transform:
fpθ, φq “N´1ÿ
l“0
lÿ
m“´l
αml P |m|l pcosθqeimφ
[Mohlenkamp, 1999], [Rokhlin & Tygert, 2006], [Tygert, 2008]
A new generation of fast transforms with no precomputation.
Alex Townsend @ MIT 15/18
Thank you
Thank you
Alex Townsend @ MIT 16/18
References
D. H. Bailey, K. Jeyabalan, and X. S. Li, A comparison of three high-precision quadrature schemes, 2005.
P. Baratella and I. Gatteschi, The bounds for the error term of an asymptotic approximation of Jacobipolynomials, Lecture notes in Mathematics, 1988.
Z. Battels and L. N. Trefethen, An extension of Matlab to continuous functions and operators, SISC, 2004.
Iteration-free computation of Gauss–Legendre quadrature nodes and weights, SISC, 2014.
G. H. Golub and J. H. Welsch, Calculation of Gauss quadrature rules, Math. Comput., 1969.
N. Hale and A. Townsend, Fast and accurate computation of Gauss–Legendre and Gauss–Jacobi quadraturenodes and weights, SISC, 2013.
N. Hale and A. Townsend, A fast, simple, and stable Chebyshev–Legendre transform using an asymptoticformula, SISC, 2014.
Y. Nakatsukasa, V. Noferini, and A. Townsend, Computing the common zeros of two bivariate functions viaBezout resultants, Numerische Mathematik, 2014.
Alex Townsend @ MIT 17/18
References
F. W. J. Olver, Asymptotics and Special Functions, Academic Press, New York, 1974.
A. Townsend and L. N. Trefethen, An extension of Chebfun to two dimensions, SISC, 2013.
A. Townsend, T. Trogdon, and S. Olver, Fast computation of Gauss quadrature nodes and weights on thewhole real line, to appear in IMA Numer. Anal., 2015.
A. Townsend, The race to compute high-order Gauss quadrature, SIAM News, 2015.
A. Townsend, A fast analysis-based discrete Hankel transform using asymptotics expansions, submitted, 2015.
F. G. Tricomi, Sugli zeri dei polinomi sferici ed ultrasferici, Ann. Mat. Pura. Appl., 1950.
Alex Townsend @ MIT 18/18