# Discrete Fourier Transform - Definition?

On the internet I have found the definition of the DFT to be : $$F(k) = \frac{1}{\sqrt{N}} \sum\limits_{n=0}^{N-1} f(n) e^{-\frac{2\pi}{N}jkn}$$ But in this article I have found an implementation which doesn't really match the formular above. Are there different definitions ? Can I exchange the $e^{-\frac{2\pi}{N}jkn}$-part with something else? And if yes, why ?

The implementation in the article I mentioned above looks similar to:

for (i = 0; i <= transformLength /2; i++) {
cosPart[i] = 0;
sinPart[i] = 0;
for (k = 0; k < transformLength; k++) {

tmp = 2*i*M_PI*( double)k/(double)transformLength;
sinPart[i] += inputData[k] * (-1) * sin(tmp);
cosPart[i] += inputData[k] * cos(tmp);
}
}


Could someone explain to me the context between the sin/cos functions and the e-function in the definition formular?

-

The following equation holds for all $z\in\mathbb{C}$:

$e^{iz}=\cos z+i\sin z$

With, of course, $i=\sqrt{-1}$. This relation is known as Euler's formula, and you can see it is true by looking at the power series of the exponential, the cosine and the sine.

The article you linked computes the imaginary part of the Fourier transform explicitly, meaning without using complex numbers, and saves it separately as sinPart.

-
$$X_n=\sum_{k=0}^{N-1} x_k \exp\left(-\frac{2\pi i kn}{N}\right)$$