limits of integration in the coef¬cient integrals (2.2) are also changed from [’π, π] to [0, 2π].

Second note: the general Fourier series can also be written in the complex form

∞

(2.3)

f (x) = cn exp(inx)

n=’∞

where the coef¬cients are

π

(2.4)

cn = (1/2π) f (x) exp(’inx)dx

’π

The identities

cos(x) ≡ (exp(ix) + exp(’ix))/2; sin(x) ≡ (exp(ix) ’ exp(’ix))/(2i), (2.5)

show that (2.3) and (2.1) are completely equivalent, and we shall use whichever is conve-

nient. The coef¬cients of the two forms are related by

c0 = a0 , n=0

(an ’ ibn )/2, n>0

cn =

(an + ibn )/2, n<0

Often, it is unnecessary to use the full Fourier series. In particular, if f (x) is known to

have the property of being symmetric about x = 0, which means that f (x) = f (’x) for all

x, then all the sine coef¬cients are zero. The series with only the constant and the cosine

terms is known as a “Fourier cosine series”. (A Chebyshev series is a Fourier cosine series

with a change of variable.) If f (x) = ’f (’x) for all x, then f (x) is said to be antisymmetric

about x = 0 and all the an = 0. Its Fourier series is a sine series. These special cases are

extremely important in applications as discussed in the Chapter 8.

2.2. FOURIER SERIES 21

De¬nition 1 (PERIODICITY)

A function f (x) is PERIODIC with a period of 2 π if

(2.6)

f (x) = f (x + 2π)

for all x.

To illustrate these abstract concepts, we will look at four explicit examples. These will

allow us to develop an important theme: The smoother the function, more rapidly its spec-

tral coef¬cients converge.

EXAMPLE ONE: “Piecewise Linear” or “Sawtooth” Function

Since the basis functions of the Fourier expansion, {1, cos(nx), sin(nx)}, all are peri-

odic, it would be reasonable to suppose that the Fourier series would be useful only for

expanding functions that have this same property. In fact, this is only half-true. Fourier se-

ries work best for periodic functions, and whenever possible, we will use them only when

the boundary conditions are that the solution be periodic. (Geophysical example: because

the earth is round, atmospheric ¬‚ows are always periodic in longitude). However, Fourier

series will converge, albeit slowly, for quite arbitrary f (x).

In keeping with our rather low-brow approach, we will prove this by example. Suppose

we take f (x) = x, evaluate the integrals (2.2) and sum the series (2.1). What do we get?

Because all the basis functions are periodic, their sum must be periodic even if the

function f (x) in the integrals is not periodic. The result is that the Fourier series converges

to the so-called “saw-tooth” function (Fig. 2.1).

Since f (x) ≡ x is antisymmetric, all the an are 0. The sine coef¬cients are

π

bn = (1/π) x sin(nx)dx

’π

n+1

(2.7)

= (’1) (2/n)

Since the coef¬cients are decreasing as O(1/n), the series does not converge with blaz-

ing speed; in fact, this is the worst known example for an f (x) which is continuous.

Nonetheless, Fig. 2.2 shows that adding more and more terms to the sine series does indeed

generate a closer and closer approximation to a straight line.

The graph of the error shows that the discontinuity has polluted the approximation

with small, spurious oscillations everywhere. At any given ¬xed x, however, the ampli-

tude of these oscillations decreases as O(1/N ). Near the discontinuity, there is a region

where (i) the error is always O(1) and (ii) the Fourier partial sum overshoots f (x) by the

same amount, rising to a maximum of about 1.18 instead of 1, independent of N. Collec-

tively, these facts are known as “Gibbs™ Phenomenon”. Fortunately, through “¬ltering”,

“sequence acceleration” and “reconstruction”, it is possible to ameliorate some of these

π

’2π 0

’π 2π 3π

Figure 2.1: “Sawtooth” (piecewise linear) function.

CHAPTER 2. CHEBYSHEV & FOURIER SERIES

22

3 1.5

N=18

N=18

2.5

1

2

0.5

1.5

0

1 N=3

-0.5

N=3

0.5

0 -1

0 1 2 3 0 1 2 3

Figure 2.2: Left: partial sums of the Fourier series of the piecewise linear (“sawtooth”)

function (divided by π) for N=3 , 6, 9, 12, 15, 18. Right: errors. For clarity, both the partial

sums and errors have been shifted with upwards with increasing N.

problems. Because shock waves in ¬‚uids are discontinuities, shocks produce Gibbs™ Phe-

nomenon, too, and demand the same remedies.

EXAMPLE TWO: “Half-Wave Recti¬er” Function

This is de¬ned on t ∈ [0, 2π] by

±

sin(t), 0<t<π

f (t) ≡

0, π < t < 2π

and is extended to all t by assuming that this pattern repeats with a period of 2 π. [Geo-

physical note: this approximately describes the time dependence of thermal tides in the

earth™s atmosphere: the solar heating rises and falls during the day but is zero at night.]

Integration gives the Fourier coef¬cients as

a2n = ’2/[π(4n2 ’ 1)] a2n+1 = 0(n ≥ 1) (2.8)

a0 = (1/π); (n > 0);

(2.9)

b1 = 1/2; b2n = 0 (n > 1)

Fig. 2.3 shows the sum of the ¬rst four terms of the series, f4 (x) = 0.318 + 0.5 sin(t) ’

0.212 cos(2t)’0.042 cos(4t). The graph shows that the series is converging much faster than

that for the saw-tooth function. At t = π/2, where f (t) = 1.000, the ¬rst four terms sum to

0.988, an error of only 1.2 %.

This series converges more rapidly than that for the “saw-tooth” because the “half-

wave recti¬er” function is smoother than the “saw-tooth” function. The latter is discontin-

uous and its coef¬cients decrease as O(1/n) in the limit n ’ ∞; the “half-wave recti¬er” is

continuous but its ¬rst derivative is discontinous, so its coef¬cients decrease as O(1/n2 ). This

is a general property: the smoother a function is, the more rapidly its Fourier coef¬cients will

decrease, and we can explicitly derive the appropriate power of 1/n.

2.2. FOURIER SERIES 23

1

0.5

0

0 2 4 6 8 10 12

t

1

0.5

0

0 1 2 3 4 5 6

t

Figure 2.3: Top: graph of the “half-wave recti¬er” function. Bottom: A comparison of the

“half-wave recti¬er” function [dashed] with the sum of the ¬rst four Fourier terms [solid].

f4 (x) = 0.318 + 0.5 sin(t) ’ 0.212 cos(2 t) ’ 0.042 cos(4 t). The two curves are almost

indistinguishable.

Although spectral methods (and all other algorithms!) work best when the solution is

smooth and in¬nitely differentiable, the “half-wave recti¬er” shows that this is not always

possible.

EXAMPLE THREE: In¬nitely Differentiable but Singular for Real x

f (x) ≡ exp{’ cos2 (x)/ sin2 (x)} (2.10)

This function has an essential singularity of the form exp(’1/x2 ) at x = 0. The power

series about x = 0 is meaningless because all the derivatives of (2.10) tend to 0 as x ’ 0.

However, the derivatives exist because their limit as x ’ 0 is well-de¬ned and bounded.

The exponential decay of exp(’1/x2 ) is suf¬cient to overcome the negative powers of x

that appear when we differentiate so that none of the derivatives are in¬nite. Boyd (1982a)

shows that the Fourier coef¬cients of (2.10) are asymptotically of the form

an ∼ [ ] exp(’1.5n2/3 ) cos(2.60n2/3 + π/4) (2.11)

where [] denotes an algebraic factor of n irrelevant for present purposes. Fast convergence,

even though the power series about x = 0 is useless, is a clear signal that spectral expan-

sions are more potent than Taylor series (Fig. 2.4).

This example may seem rather contrived. However, “singular-but-in¬nitely-differentiable”

is actually the most common case for functions on an in¬nite or semi-in¬nite interval. Most

functions have such bounded singularities at in¬nity, that is, at one or both endpoints of

the expansion interval.

EXAMPLE FOUR: “Symmetric, Imbricated-Lorentzian” (SIP) Function

f (x) ≡ (1 ’ p2 )/ (1 + p2 ) ’ 2p cos(x) (2.12)

CHAPTER 2. CHEBYSHEV & FOURIER SERIES

24

f Fourier coeffs.

0

1 10

-2

0.8 10

-4

0.6 10

-6

0.4 10

-8

0.2 10

-10

0 10

-2 0 2 10 20 30 40

x degree n

Figure 2.4: Left: graph of f (x) ≡ exp(’ cos2 (x) / sin2 (x) ). Right: Fourier cosine coef¬-

cients of this function. The sine coef¬cients are all zero because this function is symmetric

with respect to x = 0.

where p < 1 is a constant. This f (x) is a periodic function which is in¬nitely differentiable and

continuous in all its derivatives. Its Fourier series is

∞

pn cos(nx) (2.13)

f (x) = 1 + 2

n=1

This example illustrates the “exponential” and “geometric” convergence which is typ-

ical of solutions to differential equations in the absence of shocks, corner singularities, or

discontinuities.

We may describe (2.13) as a “geometrically-converging” series because at x = 0, this is

a geometric series. Since | cos(nx) | ¤ 1 for all n and x, each term in the Fourier series is

bounded by the corresponding term in the geometric power series in p for all x. Because

this rate of convergence is generic and typical, it is important to understand that it is qual-

itatively different from the rate of the convergence of series whose terms are proportional

to some inverse power of n.

Note that each coef¬cient in (2.13) is smaller than its predecessor by a factor of p where

p < 1. However, if the coef¬cients were decreasing as O(1/nk ) for some ¬nite k where

k = 1 for the “saw-tooth” and k = 2 for the “half-wave recti¬er”, then

∼ nk /(n + 1)k

an+1 /an

∼ 1 ’ k/n for n >> k (2.14)

∼1 [Non ’ exponential Convergence]

Thus, even if k is a very large number, the ratio of an+1 /an tends to 1 from below

for large n. This never happens for a series with “exponential” convergence; the ratio of

| an+1 /an | is always bounded away from one ” by p in (2.13), for example.

2.3. ORDERS OF CONVERGENCE 25