Discrete Chebyshev transform

In applied mathematics, a discrete Chebyshev transform (DCT) is an analog of the discrete Fourier transform for a function of a real interval, converting in either direction between function values at a set of Chebyshev nodes and coefficients of a function in Chebyshev polynomial basis. Like the Chebyshev polynomials, it is named after Pafnuty Chebyshev.

The two most common types of discrete Chebyshev transforms use the grid of Chebyshev zeros, the zeros of the Chebyshev polynomials of the first kind T n ( x ) {\displaystyle T_{n}(x)} and the grid of Chebyshev extrema, the extrema of the Chebyshev polynomials of the first kind, which are also the zeros of the Chebyshev polynomials of the second kind U n ( x ) {\displaystyle U_{n}(x)} . Both of these transforms result in coefficients of Chebyshev polynomials of the first kind.

Other discrete Chebyshev transforms involve related grids and coefficients of Chebyshev polynomials of the second, third, or fourth kinds.

Discrete Chebyshev transform on the roots grid

The discrete chebyshev transform of u(x) at the points x n {\displaystyle {x_{n}}} is given by:

a m = p m N n = 0 N 1 u ( x n ) T m ( x n ) {\displaystyle a_{m}={\frac {p_{m}}{N}}\sum _{n=0}^{N-1}u(x_{n})T_{m}(x_{n})}

where:

x n = cos ( π N ( n + 1 2 ) ) {\displaystyle x_{n}=-\cos \left({\frac {\pi }{N}}(n+{\frac {1}{2}})\right)}
a m = p m N n = 0 N 1 u ( x n ) cos ( m cos 1 ( x n ) ) {\displaystyle a_{m}={\frac {p_{m}}{N}}\sum _{n=0}^{N-1}u(x_{n})\cos \left(m\cos ^{-1}(x_{n})\right)}

where p m = 1 m = 0 {\displaystyle p_{m}=1\Leftrightarrow m=0} and p m = 2 {\displaystyle p_{m}=2} otherwise.

Using the definition of x n {\displaystyle x_{n}} ,

a m = p m N n = 0 N 1 u ( x n ) cos ( m π N ( N + n + 1 2 ) ) {\displaystyle a_{m}={\frac {p_{m}}{N}}\sum _{n=0}^{N-1}u(x_{n})\cos \left({\frac {m\pi }{N}}(N+n+{\frac {1}{2}})\right)}
a m = p m N n = 0 N 1 u ( x n ) ( 1 ) m cos ( m π N ( n + 1 2 ) ) {\displaystyle a_{m}={\frac {p_{m}}{N}}\sum _{n=0}^{N-1}u(x_{n})(-1)^{m}\cos \left({\frac {m\pi }{N}}(n+{\frac {1}{2}})\right)}

and its inverse transform:

u n = m = 0 N 1 a m T m ( x n ) {\displaystyle u_{n}=\sum _{m=0}^{N-1}a_{m}T_{m}(x_{n})}

(This so happens to the standard Chebyshev series evaluated on the roots grid.)

u n = m = 0 N 1 a m cos ( m π N ( N + n + 1 2 ) ) {\displaystyle u_{n}=\sum _{m=0}^{N-1}a_{m}\cos \left({\frac {m\pi }{N}}(N+n+{\frac {1}{2}})\right)}
u n = m = 0 N 1 a m ( 1 ) m cos ( m π N ( n + 1 2 ) ) {\displaystyle \therefore u_{n}=\sum _{m=0}^{N-1}a_{m}(-1)^{m}\cos \left({\frac {m\pi }{N}}(n+{\frac {1}{2}})\right)}

This can readily be obtained by manipulating the input arguments to a discrete cosine transform.

This can be demonstrated using the following MATLAB code:

function a=fct(f, l)
% x =-cos(pi/N*((0:N-1)'+1/2));

f = f(end:-1:1,:);
A = size(f); N = A(1); 
if exist('A(3)', 'var') && A(3)~=1
    for i=1:A(3)
        a(:,:,i) = sqrt(2/N) * dct(f(:,:,i));
        a(1,:,i) = a(1,:,i) / sqrt(2);
    end
else
    a = sqrt(2/N) * dct(f(:,:,i));
    a(1,:)=a(1,:) / sqrt(2);
end

The discrete cosine transform (dct) is in fact computed using a fast Fourier transform algorithm in MATLAB.

And the inverse transform is given by the MATLAB code:

function f=ifct(a, l)
% x = -cos(pi/N*((0:N-1)'+1/2)) 
k = size(a); N=k(1);

a = idct(sqrt(N/2) * [a(1,:) * sqrt(2); a(2:end,:)]);

end

Discrete Chebyshev transform on the extrema grid

This transform uses the grid:

x n = cos ( n π N ) {\displaystyle x_{n}=-\cos \left({\frac {n\pi }{N}}\right)}
T n ( x m ) = cos ( π m n N + n π ) = ( 1 ) n cos ( π m n N ) {\displaystyle T_{n}(x_{m})=\cos \left({\frac {\pi mn}{N}}+n\pi \right)=(-1)^{n}\cos \left({\frac {\pi mn}{N}}\right)}

This transform is more difficult to implement by use of a Fast Fourier Transform (FFT). However it is more widely used because it is on the extrema grid which tends to be most useful for boundary value problems. Mostly because it is easier to apply boundary conditions on this grid.

In this case the transform and its inverse are

u ( x n ) = u n = m = 0 N a m T m ( x n ) {\displaystyle u(x_{n})=u_{n}=\sum _{m=0}^{N}a_{m}T_{m}(x_{n})}
a m = p m N [ 1 2 ( u 0 ( 1 ) m + u N ) + n = 1 N 1 u n T m ( x n ) ] {\displaystyle a_{m}={\frac {p_{m}}{N}}\left[{\frac {1}{2}}(u_{0}(-1)^{m}+u_{N})+\sum _{n=1}^{N-1}u_{n}T_{m}(x_{n})\right]}

where p m = 1 m = 0 , N {\displaystyle p_{m}=1\Leftrightarrow m=0,N} and p m = 2 {\displaystyle p_{m}=2} otherwise.

Usage and implementations

The primary uses of the discrete Chebyshev transform are numerical integration, interpolation, and stable numerical differentiation.[1] An implementation which provides these features is given in the C++ library Boost.[2]

See also

References

  1. ^ Trefethen, Lloyd (2013). Approximation Theory and Approximation Practice.
  2. ^ Thompson, Nick; Maddock, John. "Chebyshev Polynomials". boost.org.