Jump to content

Discrete Chebyshev transform: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
 
(31 intermediate revisions by 19 users not shown)
Line 1: Line 1:
In [[applied mathematics]], a '''discrete Chebyshev transform''' (DCT) is an analog of the [[discrete Fourier transform]] for a [[function (mathematics)|function]] of a [[real interval]], converting in either direction between function values at a set of [[Chebyshev nodes]] and [[coefficient]]s of a function in [[Chebyshev polynomials|Chebyshev polynomial]] basis. Like the Chebyshev polynomials, it is named after [[Pafnuty Chebyshev]].
{{Unreferenced|date=February 2012}}
In [[applied mathematics]], the '''discrete Chebyshev transform (DCT)''', named after [[Pafnuty Chebyshev]], is one of either of two main varieties of DCTs: the discrete Chebyshev transform on the 'roots' grid of the [[Chebyshev polynomials]] of the first kind <math> T_n (x) </math>, and the discrete Chebyshev transform on the 'extrema' grid of the Chebyshev polynomials of the first kind.


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 <math> T_n (x) </math> 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 <math> U_n (x) </math>. Both of these transforms result in coefficients of Chebyshev polynomials of the first kind.
==The DCT on the 'roots' grid==

The discrete chebyshev transform of u(x) at the points <math>{x_n}</math> is given by:
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 <math>{u(x)}</math> at the points <math>{x_n}</math> is given by:
: <math> a_m =\frac{p_m}{N}\sum_{n=0}^{N-1} u(x_n) T_m (x_n) </math>
: <math> a_m =\frac{p_m}{N}\sum_{n=0}^{N-1} u(x_n) T_m (x_n) </math>


Line 24: Line 27:
: <math> u_n =\sum_{m=0}^{N-1} a_m T_m (x_n) </math>
: <math> u_n =\sum_{m=0}^{N-1} a_m T_m (x_n) </math>


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


: <math> u_n =\sum_{m=0}^{N-1} a_m \cos\left(\frac{m\pi}{N}(N+n+\frac{1}{2}) \right) </math>
: <math> u_n =\sum_{m=0}^{N-1} a_m \cos\left(\frac{m\pi}{N}(N+n+\frac{1}{2}) \right) </math>
Line 34: Line 37:
This can be demonstrated using the following [[MATLAB]] code:
This can be demonstrated using the following [[MATLAB]] code:


<source lang="matlab">
<syntaxhighlight lang="matlab">
function a=fct(f,l)
function a=fct(f, l)
%x=-cos(pi/N*((0:N-1)'+1/2));
% x =-cos(pi/N*((0:N-1)'+1/2));


f=f(end:-1:1,:);
f = f(end:-1:1,:);
A=size(f); N=A(1);
A = size(f); N = A(1);
if exist('A(3)','var') && A(3)~=1
if exist('A(3)', 'var') && A(3)~=1
for i=1:A(3)
for i=1:A(3)
a(:,:,i) = sqrt(2/N) * dct(f(:,:,i));
a(:,:,i)=sqrt(2/N)*dct(f(:,:,i));
a(1,:,i) = a(1,:,i) / sqrt(2);
a(1,:,i)=a(1,:,i)/sqrt(2);
end
end
else
else
a = sqrt(2/N) * dct(f(:,:,i));
a(1,:)=a(1,:) / sqrt(2);
end
</syntaxhighlight>
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:
a=sqrt(2/N)*dct(f(:,:,i));
a(1,:)=a(1,:)/sqrt(2);


<syntaxhighlight lang="matlab">
end
function f=ifct(a, l)
</source>
% x = -cos(pi/N*((0:N-1)'+1/2))
The discrete cosine transform (dct) is in fact computed using a fast fourier transform algorithm in MATLAB. <br>
k = size(a); N=k(1);
And the inverse transform is given by the MATLAB code:<br>
<source lang="matlab">
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,:)]);
a = idct(sqrt(N/2) * [a(1,:) * sqrt(2); a(2:end,:)]);


end
end
</syntaxhighlight>


==Discrete Chebyshev transform on the extrema grid==
</source>

==Extrema grid==
This transform uses the grid:
This transform uses the grid:


Line 75: Line 75:


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.
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.

There is a discrete (and in fact fast because it performs the dct by using a fast fourier transform) available at the MATLAB file exchange that was created by Greg von Winckel. So it is omitted here.


In this case the transform and its inverse are
In this case the transform and its inverse are
Line 84: Line 82:
: <math> 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] </math>
: <math> 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] </math>


where <math> p_m </math> is as it was in the last section.
where <math> p_m =1 \Leftrightarrow m=0, N </math> and <math> p_m = 2 </math> otherwise.

==Usage and implementations==
The primary uses of the discrete Chebyshev transform are numerical integration, interpolation, and stable numerical differentiation.<ref>{{cite book|title=Approximation Theory and Approximation Practice|first1=Lloyd|last1=Trefethen|year=2013}}</ref> An implementation which provides these features is given in the [[C++]] library Boost.<ref>{{cite web|title=Chebyshev Polynomials|url=http://www.boost.org/doc/libs/release/libs/math/doc/html/math_toolkit/sf_poly/chebyshev.html|website=boost.org|last1=Thompson|first1=Nick|last2=Maddock|first2=John}}</ref>

==See also==
* [[Chebyshev polynomials]]
* [[Discrete cosine transform]]
* [[Discrete Fourier transform]]
* [[List of Fourier-related transforms]]

==References==
{{reflist}}


[[Category:Transforms]]
[[Category:Transforms]]
[[Category:Articles with example MATLAB/Octave code]]

Latest revision as of 19:01, 17 December 2024

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 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 . 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

[edit]

The discrete Chebyshev transform of at the points is given by:

where:

where and otherwise.

Using the definition of ,

and its inverse transform:

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

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

[edit]

This transform uses the grid:

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

where and otherwise.

Usage and implementations

[edit]

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

[edit]

References

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