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.

-

What has not been mentioned is that different books, papers, and software will have different conventions on the normalization of the discrete Fourier transform. One normalization that is a bit more common than the one in the OP is

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

that is, without the normalizing factor in front that makes for convenient formulae for the forward and inverse transform. Sometimes, one will have a forward transform without the minus sign in the exponential. If you're going to be doing Fourier work, ensure that the normalization conventions you are using in your work is the same as the convention in the software you will be using.

-