Parallel Spectral Numerical Methods/One-Dimensional Discrete Fourier Transforms

From testwiki
Jump to navigation Jump to search

The discrete Fourier transform (DFT) takes a function sampled at a finite number of points and finds the coefficients for the linear combination of trigonometric polynomials that best approximates the function; the number of trigonometric polynomials used is equal to the number of sample points. Suppose we have a function f(x) which is defined on the interval axb. Due to memory limitations, a computer can only store values at a finite number of sample points, i.e. ax0<x1<...<xnb. For our purposes these points will be equally spaced, for example x1x0=x3x2, and so we can write

xj=a+jh,j=0,1,2,...,n

where xj are the sample points, n is the number of sample points and

h=ban.

It is convenient to use the standard interval, for which 0x2π. Rewriting x in terms of standard interval yields

x0=0,x1=2πn,x2=4πn,xj=2jπn,...,xn1=2(n1)πn

Notice how xn=2π is omitted; periodicity implies that the value of the function at 2π is the same as the value of the function at 0, so it need not be included. We will introduce the DFT using the language of linear algebra. Much of this formalism carries over to continuous functions that are being approximated. It also makes it easier to understand the computer implementation of the algorithms. Many computer packages and programs are optimized to perform calculations through matrix operations, so the formalism is also useful when actually calculating transforms. We write the approximation to f(x) at the sample points as a finite dimensional vector

f=(f0,f1,...,fn1)T=(f(x0),f(x1),...,f(xn1))

where

fj=f(xj)=f(2jπn).

The DFT decomposes the sampled function f(x) into a linear combination of complex exponentials, exp(ikx) where k is an index. Since

exp(ikx)=cos(kx)+isin(kx),

we also obtain an expansion in trigonometric functions, which may be more familiar from courses in calculus and differential equations. Since the function is sampled at n points, the highest frequency of oscillation that can be resolved will have n oscillations. Any frequencies higher than n in the original function are not adequately resolved and cause an aliasing error (see, for example, Boyd[1] or Uecker[2] for more on this). This error can be reduced by sampling at a greater number of points so that the number of approximating exponentials functions can also be increased. There is a tradeoff between increasing the accuracy of the simulation and the time required for the simulation to complete. For many cases of scientific and practical interest, simulations with up to thousands of grid points can be computed relatively quickly. Below we explain how a function f(x) can be approximated by an interpolating trigonometric polynomial p(x) so that

f(x)p(x)=c0+c1e2ix+c2e2ix+...+cn1e(n1)ix=k=0n1ckeikx

The symbol means that f(x) and p(x) agree on each sample point, i.e. f(xj)=p(xj) for each j=0,1,...n1, but the interpolated polynomial p(x) is only an approximation of the true solution f(x) away from the sample points.. The cn are called discrete Fourier coefficients and are what we will be looking to solve for. p(x) represents the values of interpolating trigonometric polynomial of degree n1, so if we have the values of these coefficients then we have a function we can use. Since we are working in a finite-dimensional vector space, a useful approach is to rewrite the discrete Fourier series as a vector. We let

ωk=(eikx0,eikx1,eikx2,...,eikxn)T

=(1,e2kπi/n,e4kπi/n,...,e2(n1)kπi/n)T,

where k=0,1,...,n1. The interpolation conditions, f(xj)=p(xj), can also be rewritten in vectorial form

Template:NumBlk

Here f is a vector evaluated at the sample points, which is decomposed into vectors ωk, much as a vector in three dimensional space can be decomposed into the components in the x, y and z directions. The discrete Fourier transform allows us to compute the coefficients ci given the value of the function at the sample points. This may at first seem unmotivated, but in many applications, such as solving differential equations, it is easier to manipulate a linear combination of trigonometric polynomials, ω0,...,ωn1, than it is to work with the original function. In order to solve for ck, we use the orthonormality of the basis elements ω0,...,ωn1. We now explain how this is done (For a more detailed explanation see Olver and Shakiban[3].).

Define ξn=e2πi/n. We observe that

(ξn)n=exp(2πinn)=cos(2π)+isin(2π)=1

For this reason ξn is known as the primitive nth root of unity. Note also that for 0k<n, we have that (ξnk)n=1, so all other roots of unity when taken to the power n can be obtained from the primitive nth root of unity. We will use this to perform the DFT algorithm to calculate the coefficients c0,...,ck1 in eq. Template:EquationNote. The main idea behind the DFT algorithm is to use orthogonality of the vectors ωk. To show the orthogonality between the vectors ωk and ωl, we let ωl* denote the complex conjugate of ωl, and then take the inner product of ωk and ωl and find that


<ωk,ωl>

=1nm=0n1exp(2πikmn)[exp(2πilmn)]*

=1nm=0n1exp(2πi(kl)mn)

=1nm=0n1cos(π(kl)mn)+isin(π(kl)mn)

=1 if k=l and 0 otherwise.

To deduce the last part, if k=l then exp(0)=1, and if kl, then we are sampling the sine and cosine functions at equally spaced points on over an integral number of wavelengths. Since these functions have equal magnitude positive and negative parts, they sum to zero, much as the integral of a sine or cosine over an integral number of wavelengths is zero. This implies that we can compute the Fourier coefficients in the discrete Fourier sum by taking inner products

ck=<f,ωk>=1nm=0n1ξnmkfj.

We note the close connection between the continuous and discrete settings, where an integral is replaced by a sum.

Fast Fourier Transform

Computing the Fourier coefficients, c0,...,cn1 using the DFT from the definition can be very slow for large values of n. Computing the Fourier coefficients c0,...cn1 requires n2n complex multiplications and n2n complex additions. In 1960, Cooley and Tukey[4] rediscovered a much more efficient way of computing DFT by developing an algorithm known as the Fast Fourier Transforms (FFT). The FFT cuts the number of arithmetic operations down to O(nlogn). For large values of n, this can make a huge difference in computation time compared to the standard DFT. The reason why the FFT is so important is that it is heavily used spectral methods. The basic FFT algorithm used by Cooley and Tukey[5] is well documented in many places, however, there are other implementations of the algorithm and the best version of the algorithm to use depends heavily on computer architecture. We therefore do not give further descriptions here.


Notes

References

Template:Cite book

Template:Cite journal

Template:Cite book

Template:Cite book

http://en.wikipedia.org/wiki/Fast_Fourier_transform

Template:BookCat