Jump to: navigation, search

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


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.