This chapter is concerned with the following tasks.
(a) Calculating the discrete Fourier transform of a sequence of real or complex data values.
(b) Calculating the discrete convolution or the discrete correlation of two sequences of real or complex data values using discrete Fourier transforms.
(c) Calculating the inverse Laplace transform of a user-supplied method.
(d) Direct summation of orthogonal series.
(e) Acceleration of convergence of a seuqnce of real values.

Syntax

C#
public static class C06
Visual Basic
Public NotInheritable Class C06
Visual C++
public ref class C06 abstract sealed
F#
[<AbstractClassAttribute>]
[<SealedAttribute>]
type C06 =  class end

Background to the Problems

Discrete Fourier Transforms

Complex transforms

Most of the methods in this chapter calculate the finite discrete Fourier transform (DFT) of a sequence of n complex numbers zj, for j=0,1,,n-1. The direct transform is defined by
z^k=1nj=0n-1zjexp-i2πjkn (1)
for k=0,1,,n-1. Note that equation (1) makes sense for all integral k and with this extension z^k is periodic with period n, i.e., z^k=z^k±n, and in particular z^-k=z^n-k. Note also that the scale-factor of 1n may be omitted in the definition of the DFT, and replaced by 1n in the definition of the inverse.
If we write zj=xj+iyj and z^k=ak+ibk, then the definition of z^k may be written in terms of sines and cosines as
ak=1nj=0n-1xjcos2πjkn+yjsin2πjkn
bk=1nj=0n-1yjcos2πjkn-xjsin2πjkn.
The original data values zj may conversely be recovered from the transform z^k by an inverse discrete Fourier transform:
zj=1nk=0n-1z^kexp+i2πjkn (2)
for j=0,1,,n-1. If we take the complex conjugate of (2), we find that the sequence z-j is the DFT of the sequence z^-k. Hence the inverse DFT of the sequence z^k may be obtained by taking the complex conjugates of the z^k; performing a DFT, and taking the complex conjugates of the result. (Note that the terms forward transform and backward transform are also used to mean the direct and inverse transforms respectively.)
The definition (1) of a one-dimensional transform can easily be extended to multidimensional transforms. For example, in two dimensions we have
z^k1k2=1n1n2j1=0n1-1j2=0n2-1zj1j2exp-i2πj1k1n1exp-i2πj2k2n2. (3)
Note:  definitions of the discrete Fourier transform vary. Sometimes (2) is used as the definition of the DFT, and (1) as the definition of the inverse.

Real transforms

If the original sequence is purely real valued, i.e., zj=xj, then
z^k=ak+ibk=1nj=0n-1xjexp-i2πjkn
and z^n-k is the complex conjugate of z^k. Thus the DFT of a real sequence is a particular type of complex sequence, called a Hermitian sequence, or half-complex or conjugate symmetric, with the properties
an-k=akbn-k=-bkb0=0
and, if n is even, bn/2=0.
Thus a Hermitian sequence of n complex data values can be represented by only n, rather than 2n, independent real values. This can obviously lead to economies in storage, with two schemes being used in this chapter. In the first (deprecated) scheme, which will be referred to as the real storage format for Hermitian sequences, the real parts ak for 0kn/2 are stored in normal order in the first n/2+1 locations of an array x of length n; the corresponding nonzero imaginary parts are stored in reverse order in the remaining locations of x. To clarify, if x is declared with bounds 0:n-1 in your calling method, the following two tables illustrate the storage of the real and imaginary parts of z^k for the two cases: n even and n odd.
If n is even then the sequence has two purely real elements and is stored as follows:
Index of x012 n/2 n-2 n-1
Sequence a0 a1+ib1 a2+ib2 an/2 a2-ib2 a1-ib1
Stored values a0 a1 a2 an/2 b2 b1
x[k]=ak,for ​k=0,1,,n/2, andx[n-k]=bk,for ​k=1,2,,n/2-1.
If n is odd then the sequence has one purely real element and, letting n=2s+1, is stored as follows:
Index of x012 s s+1 n-2 n-1
Sequence a0 a1+ib1 a2+ib2 as+ibs as-ibs a2-ib2 a1-ib1
Stored values a0 a1 a2 as bs b2 b1
x[k]=ak,for ​k=0,1,,s, andx[n-k]=bk,for ​k=1,2,,s.
The second (recommended) storage scheme, referred to in this chapter as the complex storage format for Hermitian sequences, stores the real and imaginary parts ak,bk, for 0kn/2, in consecutive locations of an array x of length n+2. If x is declared with bounds 0:n+1 in your calling method, the following two tables illustrate the storage of the real and imaginary parts of z^k for the two cases: n even and n odd.
If n is even then the sequence has two purely real elements and is stored as follows:
Index of x0123 n-2 n-1 n n+1
Stored values a0 b0=0 a1 b1 an/2-1 bn/2-1 an/2 bn/2=0
x[2×k-1]=ak,for ​k=0,1,,n/2, andx[2×k+1-1]=bk,for ​k=0,1,,n/2.
If n is odd then the sequence has one purely real element and, letting n=2s+1, is stored as follows:
Index of x0123 n-2 n-1 n n+1
Stored values a0 b0=0 a1 b1 bs-1 as bs 0
x[2×k-1]=ak,for ​k=0,1,,s, andx[2×k+1-1]=bk,for ​k=0,1,,s.
Also, given a Hermitian sequence, the inverse (or backward) discrete transform produces a real sequence. That is,
xj=1na0+2k=1n/2-1akcos2πjkn-bksin2πjkn+an/2
where an/2=0 if n is odd.
For real data that is two-dimensional or higher, the symmetry in the transform persists for the leading dimension only. So, using the notation of equation (3) for the complex two-dimensional discrete transform, we have that z^k1k2 is the complex conjugate of z^n1-k1k2. It is more convenient for transformed data of two or more dimensions to be stored as a complex sequence of length n1/2+1×n2××nd where d is the number of dimensions. The inverse discrete Fourier transform operating on such a complex sequence (Hermitian in the leading dimension) returns a real array of full dimension (n1×n2××nd).

Real symmetric transforms

In many applications the sequence xj will not only be real, but may also possess additional symmetries which we may exploit to reduce further the computing time and storage requirements. For example, if the sequence xj is odd, xj=-xn-j, then the discrete Fourier transform of xj contains only sine terms. Rather than compute the transform of an odd sequence, we define the sine transform of a real sequence by
x^k=2nj=1n-1xjsinπjkn,
which could have been computed using the Fourier transform of a real odd sequence of length 2n. In this case the xj are arbitrary, and the symmetry only becomes apparent when the sequence is extended. Similarly we define the cosine transform of a real sequence by
x^k=2n12x0+j=1n-1xjcosπjkn+12-1kxn
which could have been computed using the Fourier transform of a real even sequence of length 2n.
In addition to these ‘half-wave’ symmetries described above, sequences arise in practice with ‘quarter-wave’ symmetries. We define the quarter-wave sine transform by
x^k=1nj=1n-1xjsinπj2k-12n+12-1k-1xn
which could have been computed using the Fourier transform of a real sequence of length 4n of the form
0,x1,,xn,xn-1,,x1,0,-x1,,-xn,-xn-1,,-x1.
Similarly we may define the quarter-wave cosine transform by
x^k=1n12x0+j=1n-1xjcosπj2k-12n
which could have been computed using the Fourier transform of a real sequence of length 4n of the form
x0,x1,,xn-1,0,-xn-1,,-x0,-x1,,-xn-1,0,xn-1,,x1.

Fourier integral transforms

The usual application of the discrete Fourier transform is that of obtaining an approximation of the Fourier integral transform
Fs=-ftexp-i2πstdt
when ft is negligible outside some region 0,c. Dividing the region into n equal intervals we have
Fscnj=0n-1fjexp-i2πsjcn
and so
Fkcnj=0n-1fjexp-i2πjkn
for k=0,1,,n-1, where fj=fjc/n and Fk=Fk/c.
Hence the discrete Fourier transform gives an approximation to the Fourier integral transform in the region s=0 to s=n/c.
If the function ft is defined over some more general interval a,b, then the integral transform can still be approximated by the discrete transform provided a shift is applied to move the point a to the origin.

Convolutions and correlations

One of the most important applications of the discrete Fourier transform is to the computation of the discrete convolution or correlation of two vectors x and y defined (as in Brigham (1974)) by
  • convolution: zk=j=0n-1xjyk-j
  • correlation: wk=j=0n-1x-jyk+j
(Here x and y are assumed to be periodic with period n.)
Under certain circumstances (see Brigham (1974)) these can be used as approximations to the convolution or correlation integrals defined by
zs=-xtys-tdt
and
ws=-x-tys+tdt,  -<s<.
For more general advice on the use of Fourier transforms, see Hamming (1962); more detailed information on the fast Fourier transform algorithm can be found in Gentleman and Sande (1966) and Brigham (1974).

Applications to solving partial differential equations (PDEs)

A further application of the fast Fourier transform, and in particular of the Fourier transforms of symmetric sequences, is in the solution of elliptic PDEs. If an equation is discretized using finite differences, then it is possible to reduce the problem of solving the resulting large system of linear equations to that of solving a number of tridiagonal systems of linear equations. This is accomplished by uncoupling the equations using Fourier transforms, where the nature of the boundary conditions determines the choice of transforms – see [Application to Elliptic Partial Differential Equations]. Full details of the Fourier method for the solution of PDEs may be found in Swarztrauber (1977) and Swarztrauber (1984).

Inverse Laplace Transforms

Let ft be a real function of t, with ft=0 for t<0, and be piecewise continuous and of exponential order α, i.e.,
ftMeαt
for large t, where α is the minimal such exponent.
The Laplace transform of ft is given by
Fs=0e-stftdt,  t>0
where Fs is defined for Res>α.
The inverse transform is defined by the Bromwich integral
ft=12πia-ia+iestFsds,  t>0.
The integration is performed along the line s=a in the complex plane, where a>α. This is equivalent to saying that the line s=a lies to the right of all singularities of Fs. For this reason, the value of α is crucial to the correct evaluation of the inverse. It is not essential to know α exactly, but an upper bound must be known.
The problem of determining an inverse Laplace transform may be classified according to whether (a) Fs is known for real values only, or (b) Fs is known in functional form and can therefore be calculated for complex values of s. Problem (a) is very ill-defined and no methods are provided. Two methods are provided for problem (b).

Direct Summation of Orthogonal Series

For any series of functions ϕi which satisfy a recurrence
ϕr+1x+αrxϕrx+βrxϕr-1x=0
the sum
r=0narϕrx
is given by
r=0narϕrx=b0xϕ0x+b1xϕ1x+α0xϕ0x
where
brx+αrxbr+1x+βr+1xbr+2x=arbn+1x=bn+2x=0.
This may be used to compute the sum of the series. For further reading, see Hamming (1962).

Acceleration of Convergence

This device has applications in a large number of fields, such as summation of series, calculation of integrals with oscillatory integrands (including, for example, Hankel transforms), and root-finding. The mathematical description is as follows. Given a sequence of values sn, for n=m,,m+2l, then, except in certain singular cases, parameters, a, bi, ci may be determined such that
sn=a+i=1lbicin.
If the sequence sn converges, then a may be taken as an estimate of the limit. The method will also find a pseudo-limit of certain divergent sequences – see Shanks (1955) for details.
To use the method to sum a series, the terms sn of the sequence should be the partial sums of the series, e.g., sn=k=1ntk, where tk is the kth term of the series. The algorithm can also be used to some advantage to evaluate integrals with oscillatory integrands; one approach is to write the integral (in this case over a semi-infinite interval) as
0fxdx=0a1fxdx+a1a2fxdx+a2a3fxdx+
and to consider the sequence of values
s1=0a1fxdx,  s2=0a2fxdx=s1+a1a2fxdx, etc.,
where the integrals are evaluated using standard quadrature methods. In choosing the values of the ak, it is worth bearing in mind that (C06BAF not in this release) converges much more rapidly for sequences whose values oscillate about a limit. The ak should thus be chosen to be (close to) the zeros of fx, so that successive contributions to the integral are of opposite sign. As an example, consider the case where fx=Mxsinx and Mx>0: convergence will be much improved if ak=kπ rather than ak=2kπ.

References

Brigham E O (1974) The Fast Fourier Transform Prentice–Hall
Davies S B and Martin B (1979) Numerical inversion of the Laplace transform: A survey and comparison of methods J. Comput. Phys. 33 1–32
Fox L and Parker I B (1968) Chebyshev Polynomials in Numerical Analysis Oxford University Press
Gentleman W S and Sande G (1966) Fast Fourier transforms for fun and profit Proc. Joint Computer Conference, AFIPS 29 563–578
Hamming R W (1962) Numerical Methods for Scientists and Engineers McGraw–Hill
Shanks D (1955) Nonlinear transformations of divergent and slowly convergent sequences J. Math. Phys. 34 1–42
Swarztrauber P N (1977) The methods of cyclic reduction, Fourier analysis and the FACR algorithm for the discrete solution of Poisson's equation on a rectangle SIAM Rev. 19(3) 490–501
Swarztrauber P N (1984) Fast Poisson solvers Studies in Numerical Analysis (ed G H Golub) Mathematical Association of America
Swarztrauber P N (1986) Symmetric FFT's Math. Comput. 47(175) 323–346
Wynn P (1956) On a device for computing the emSn transformation Math. Tables Aids Comput. 10 91–96

Inheritance Hierarchy

System..::..Object
  NagLibrary..::..C06

See Also