# Comparing/Contrasting Cosine and also Fourier Transforms

What are the distinctions in between a (distinct ) cosine change and also a (distinct ) Fourier change? I recognize the previous is made use of in JPEG inscribing, while the last plays a large component in signal and also photo handling. Just how relevant are they?

Cosine changes are absolutely nothing greater than faster ways for calculating the Fourier change of a series with unique proportion (as an example if the series stands for examples from an even function).

To offer a concrete instance in *Mathematica * (`$VersionNumber >= 6`

), take into consideration the series

```
smp = {1., 2., 3., 4., 5., 4., 3., 2.};
```

The series has redundancy (as an example `smp[[2]] == smp[[8]]`

, yet keep in mind that in common Fourier job, the indexing is required from $0$ to $n-1$ as opposed to $1$ to $n$). A series like `smp`

is labelled an *also * series. The distinct Fourier change of `smp`

can be anticipated to have redundancy too :

```
Fourier[smp] // Chop
{8.48528137423857, -2.414213562373095, 0, -0.4142135623730949, 0,
-0.4142135623730949, 0, -2.414213562373095}
```

and also the distinct Fourier change is itself also. One can want to have a means to calculate the distinct Fourier change without redundancy, and also this is where the type I distinct cosine change (DCT - I) can be found in :

```
FourierDCT[Take[smp, Length[smp]/2 + 1], 1] // Chop
{8.48528137423857, -2.414213562373095, 0., -0.4142135623730949, 0.}
```

The even more common type II distinct cosine change (DCT - II) is the redundancy - free method for calculating the Fourier change of a so - called "quarter wave also" series (with an added makeover to make the outcomes totally actual genuine inputs). A quarter wave also series resembles this :

```
smp = {1., 2., 3., 4., 4., 3., 2., 1.};
```

and also the document (as an example `smp[[2]] == smp[[7]]`

) is conveniently seen. DCT - II calls for just fifty percent of the offered series to do its work :

```
Exp[2 Pi I Range[0, 7]/16] Fourier[smp]/Sqrt[2] // Chop
{4.999999999999999, -1.5771610149494746, 0, -0.11208538229199128, 0,
0.11208538229199126, 0, 1.5771610149494748}
FourierDCT[Take[smp, Length[smp]/2], 2] // Chop
{5., -1.577161014949475, 0, -0.11208538229199139}
```

(We see in this instance that the exploitation of proportion in this instance brought about a somewhat extra exact outcome.)

The various other 2 sorts of distinct cosine changes, along with the 4 sorts of distinct sine changes, are planned to be redundancy - free approaches for calculating distinct Fourier changes. For DCT - I, one can manage a series of size $\frac{N}{2}+1$ as opposed to a series of size $N$, while for DCT - II, just a size $\frac{N}{2}$ series is called for. This stands for a financial savings in computational effort and time. (I think the instance of also size below ; a comparable proportion building can be developed for the instance of weird size.)

Anyway, I desire to mention 2 excellent referrals on just how FFT and also the DCTs/DSTs relate : Van Loan's and also Briggs/Henson's .

Related questions