Discrete Fourier transform

From Rosetta Code
Revision as of 15:07, 26 April 2021 by Rdm (talk | contribs) (Draft task and possible temporary problems with server used to handle LaTeX and/or proofreading issues)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Discrete Fourier transform is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

The discrete Fourier transform is a linear, invertible transformation which transforms an arbitrary sequence of complex numbers to another sequence of complex numbers of the same length. The Fast Fourier transform (FFT) is an efficient implementation of this mechanism, but one which only works for sequences which have a length which is a power of 2.

The discrete Fourier transform is a useful testing mechanism to verify the correctness of code bases which use or implement the FFT.

For this task:

  1. Implement the discrete fourier transform
  2. Implement the inverse fourier transform
  3. (optional) implement a cleaning mechanism to remove small errors introduced by floating point representation.
  4. Verify the correctness of your implementation using a small sequence of integers, such as 2 3 5 7 11

The fourier transform of a sequence of length is given by:


The inverse transform is given by: