The fast Fourier transform

The method outlined in Sect. 5.7 for solving Poisson's equation in 2-d with
simple Dirichlet boundary conditions in the -direction requires us to perform very many
Fourier-sine transforms:

(169)

for , and inverse Fourier-sine transforms:

(170)

Here, is the value of at .
Thus, Eq. (169) is analogous to Eqs. (153) and (156), whereas
Eq. (170) can be used to reconstruct the from the .
Likewise, the
method outlined in Sect. 5.8 for solving Poisson's equation in 2-d with
simple Neumann boundary conditions in the -direction requires us to perform very many
Fourier-cosine transforms:

(171)

for , and inverse Fourier-cosine transforms:

(172)

Unfortunately, performing such transforms directly requires arithmetic
operations, which means that they are extremely expensive in terms of cpu resources.
There is, however, an ingenious
algorithm for performing Fourier transforms which only takes arithmetic
operations [which is much less than operations when is large].
This algorithm is known as the fast Fourier transform or FFT.35

The details of the FFT algorithm lie beyond the scope of this course. Roughly speaking,
the algorithm works by building up the transform in stages using
2, 4, 8, 16, etc. grid-points. In this course, we shall employ the
best-known publicly available FFT library,
called the fftw library,36 to perform all of our Fourier-sine and -cosine transforms.
Unfortunately, the fftw library does not directly calculate Fourier-sine and
-cosine transforms.37 Instead, it calculates complex Fourier transforms:

(173)

for , and complex inverse Fourier transforms:

(174)

Note that and are periodic in with period .
Note, further, that the data-sets associated with complex Fourier transforms contain twice as many
elements as the data-sets associated with sine and cosine transforms.
However, we can easily convert a sine or cosine transform into a complex transform by extending
its data-set. Thus, for a sine transform we write:

(175)

(176)

for , in which case

(177)

Likewise, for a cosine transform we write:

(178)

(179)

for , in which case

(180)

Listed below are a set of wrapper routines which employ the fftw library to
perform Fourier-sine and -cosine transforms.