Difference between revisions of "DCTIV"

From TORI
Jump to navigation Jump to search
 
m (Text replacement - "\$([^\$]+)\$" to "\\(\1\\)")
 
Line 2: Line 2:
 
<ref>
 
<ref>
 
http://en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-IV
 
http://en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-IV
</ref>, but the dash is omitted from the name DCT-IV in order to use only letters in the identifier and avoid confusion with operation of substruction. For natural number $N$, the $\mathrm{DCTIV}_N$ acts on the array $f$ of length $N$
+
</ref>, but the dash is omitted from the name DCT-IV in order to use only letters in the identifier and avoid confusion with operation of substruction. For natural number \(N\), the \(\mathrm{DCTIV}_N\) acts on the array \(f\) of length \(N\)
 
in the following way:
 
in the following way:
   
Line 12: Line 12:
 
The square of the DCTIV is identity operator:
 
The square of the DCTIV is identity operator:
   
: $ \mathrm{DCTIV}^2 f=\mathrm{DCTIV}~ \mathrm{DCTIV} f = f$
+
: \( \mathrm{DCTIV}^2 f=\mathrm{DCTIV}~ \mathrm{DCTIV} f = f\)
   
 
==Numerical implementation==
 
==Numerical implementation==
Line 18: Line 18:
 
==Approximation of the CosFourier transform==
 
==Approximation of the CosFourier transform==
   
Let $x_n=\sqrt{\frac{\pi}{N}}~ \left(n+\frac{1}{2}\right)~ ~$ , $~ ~ ~ f_n=f(x_n)$
+
Let \(x_n=\sqrt{\frac{\pi}{N}}~ \left(n+\frac{1}{2}\right)~ ~\) , \(~ ~ ~ f_n=f(x_n)\)
   
where $f$ is smooth function of real positive argument. One may extend $f$ to the negative values of the argument, assuming that it is even and smooth.
+
where \(f\) is smooth function of real positive argument. One may extend \(f\) to the negative values of the argument, assuming that it is even and smooth.
Let this $f$ efficiently decay at large values of the argument.
+
Let this \(f\) efficiently decay at large values of the argument.
 
Then, the transform can be written as
 
Then, the transform can be written as
   
: $ \displaystyle (\mathrm{DCTIV} f)_k= \sqrt{\frac{2}{N}} ~
+
: \( \displaystyle (\mathrm{DCTIV} f)_k= \sqrt{\frac{2}{N}} ~
 
\sum_{n=0}^{N-1} ~f(x_n) \cos\! \left(\frac{\pi}{N} x_n x_k\right) ~\approx ~
 
\sum_{n=0}^{N-1} ~f(x_n) \cos\! \left(\frac{\pi}{N} x_n x_k\right) ~\approx ~
\sqrt{\frac{2}{N}} \int_0^\infty ~f(x_n) \cos\! \left(x_n x_k\right) ~\mathrm d n $
+
\sqrt{\frac{2}{N}} \int_0^\infty ~f(x_n) \cos\! \left(x_n x_k\right) ~\mathrm d n \)
   
At large $N$, smoothness and quick decay at infinity is assumed for function $f$.
+
At large \(N\), smoothness and quick decay at infinity is assumed for function \(f\).
With new variable of integration $y=x_n$,
+
With new variable of integration \(y=x_n\),
the [[CosFourier]] transform $g$ of function $f$ can be approximated at the points $k_n$
+
the [[CosFourier]] transform \(g\) of function \(f\) can be approximated at the points \(k_n\)
   
: $ \displaystyle g(x_k) = \sqrt{\frac{2}{\pi}} ~
+
: \( \displaystyle g(x_k) = \sqrt{\frac{2}{\pi}} ~
 
\int_0^\infty ~f(y) \cos\! \left(y x_k\right) ~\mathrm d y
 
\int_0^\infty ~f(y) \cos\! \left(y x_k\right) ~\mathrm d y
\approx \displaystyle (\mathrm{DCTIV} f)_k $
+
\approx \displaystyle (\mathrm{DCTIV} f)_k \)
   
 
==Approximation of the Fourier coefficients==
 
==Approximation of the Fourier coefficients==
Consider the representation of some even continuous function $f$ with the Fouriet series
+
Consider the representation of some even continuous function \(f\) with the Fouriet series
   
: $ \displaystyle
+
: \( \displaystyle
f(x) = \sum_{n=0}^{\infty} c_n \cos( n x)$
+
f(x) = \sum_{n=0}^{\infty} c_n \cos( n x)\)
   
function $f$ is supposed to be symmetric, $f(x)=f(-x)$, and periodic with period $2\pi$.
+
function \(f\) is supposed to be symmetric, \(f(x)=f(-x)\), and periodic with period \(2\pi\).
The coefficients can can be expressed through the integrals with function $f$,
+
The coefficients can can be expressed through the integrals with function \(f\),
: $ \displaystyle c_0=\frac{1}{\pi} \int_0^\pi f(x) \mathrm d x$
+
: \( \displaystyle c_0=\frac{1}{\pi} \int_0^\pi f(x) \mathrm d x\)
: $ \displaystyle c_m=\frac{2}{\pi} \int_0^\pi f(x) \cos(mx) \mathrm d x~ ~ ~ $, $ ~ ~ ~ m>0$
+
: \( \displaystyle c_m=\frac{2}{\pi} \int_0^\pi f(x) \cos(mx) \mathrm d x~ ~ ~ \), \( ~ ~ ~ m>0\)
   
It seems, the direct representation above does not give a straight way for evaluation of the coefficients $c$;
+
It seems, the direct representation above does not give a straight way for evaluation of the coefficients \(c\);
 
another discretization of the [[CosFourier]] operator, it est, [[DCT]], should be used.
 
another discretization of the [[CosFourier]] operator, it est, [[DCT]], should be used.
   

Latest revision as of 18:26, 30 July 2019

DCTIV is one of realizations of the Discrete CosTransform. The name is borrowed from Wikipedia [1], but the dash is omitted from the name DCT-IV in order to use only letters in the identifier and avoid confusion with operation of substruction. For natural number \(N\), the \(\mathrm{DCTIV}_N\) acts on the array \(f\) of length \(N\) in the following way\[\displaystyle (\mathrm{DCTIV} ~f )_k = \sqrt{\frac{2}{N}} ~ \sum_{n=0}^{N-1} ~f_n~ \cos \left[\frac{\pi}{N} \left(n+\frac{1}{2}\right) \left(k+\frac{1}{2}\right) \right] \quad \quad k = 0, \dots, N-1.\]

Properties

The square of the DCTIV is identity operator:

\( \mathrm{DCTIV}^2 f=\mathrm{DCTIV}~ \mathrm{DCTIV} f = f\)

Numerical implementation

Approximation of the CosFourier transform

Let \(x_n=\sqrt{\frac{\pi}{N}}~ \left(n+\frac{1}{2}\right)~ ~\) , \(~ ~ ~ f_n=f(x_n)\)

where \(f\) is smooth function of real positive argument. One may extend \(f\) to the negative values of the argument, assuming that it is even and smooth. Let this \(f\) efficiently decay at large values of the argument. Then, the transform can be written as

\( \displaystyle (\mathrm{DCTIV} f)_k= \sqrt{\frac{2}{N}} ~ \sum_{n=0}^{N-1} ~f(x_n) \cos\! \left(\frac{\pi}{N} x_n x_k\right) ~\approx ~ \sqrt{\frac{2}{N}} \int_0^\infty ~f(x_n) \cos\! \left(x_n x_k\right) ~\mathrm d n \)

At large \(N\), smoothness and quick decay at infinity is assumed for function \(f\). With new variable of integration \(y=x_n\), the CosFourier transform \(g\) of function \(f\) can be approximated at the points \(k_n\)

\( \displaystyle g(x_k) = \sqrt{\frac{2}{\pi}} ~ \int_0^\infty ~f(y) \cos\! \left(y x_k\right) ~\mathrm d y \approx \displaystyle (\mathrm{DCTIV} f)_k \)

Approximation of the Fourier coefficients

Consider the representation of some even continuous function \(f\) with the Fouriet series

\( \displaystyle f(x) = \sum_{n=0}^{\infty} c_n \cos( n x)\)

function \(f\) is supposed to be symmetric, \(f(x)=f(-x)\), and periodic with period \(2\pi\). The coefficients can can be expressed through the integrals with function \(f\),

\( \displaystyle c_0=\frac{1}{\pi} \int_0^\pi f(x) \mathrm d x\)
\( \displaystyle c_m=\frac{2}{\pi} \int_0^\pi f(x) \cos(mx) \mathrm d x~ ~ ~ \), \( ~ ~ ~ m>0\)

It seems, the direct representation above does not give a straight way for evaluation of the coefficients \(c\); another discretization of the CosFourier operator, it est, DCT, should be used.

References