Download - Fourier series and the Gibbs phenomenon - Semantic Scholar · discontinuity-a commonsense result. Notice that in the above we took the limit in x, then we examined the limit of the

Transcript
Page 1: Fourier series and the Gibbs phenomenon - Semantic Scholar · discontinuity-a commonsense result. Notice that in the above we took the limit in x, then we examined the limit of the

Fourier series and the Gibbs phenomenonWilliam J. ThompsonDepartment of Physicsand Astronomy, University of North Carolina, Chapel Hill,North Carolina 27599-3255

(Received 11June 1991;accepted 18 October 1991)

The occurrence in Fourier series of an overshoot effect n~ar function discontinuities, called theGibbs phenomenon, is discussed from a pedagogical viewpoint. The reader is led along a path todiscover why the phenomenon depends only upon the existence of the discontinuity, but not onother properties of the function that is Fourier analyzed.

I. INTRODUCTION

An understanding of Fourier series and their generaliza-tions is important for physics and engineering students, asmuch for mathematical and physical insight as for applica-tions. Students are usually confused by the so-called Gibbsphenomenon-the persistent discrepancy, an "overshoot,"between a discontinuous function and its approximation bya Fourier series as the number of terms in the series be-comes indefinitely large. Although the phenomenon ismentioned under Fourier series in almost every textbook ofmathematicalphysics,1 the treatment is often confinedtothe square-pulse example, so that students are often leftwondering what aspect of this pulse gives rise to the phe-nomenon and whether it depends upon the function inves-tigated. The subject has also been discussed in this Jour-nal,2-4but only from a limited perspective. The aim of thispaper is to lead the reader along the steps to solving themystery of the Gibbs phenomenon.

Historically, the explanation of the Gibbs phenomenonis usually attributed to one of the first American theoreticalphysicists, J.Willard Gibbs, in two notes published in 1898and 1899 (Ref. 5). Gibbs was motivated to make an excur-sion into the theory of Fourier series by,'an observation ofAlbert Michelson that his harmonic analyzer (one of the

425 Am. J. Phys. 60 (5), May 1992

first mechanical analog computers) produced persistentoscillations near discontinuities offunctions that it Fourieranalyzed, even up to the maximum harmonic (80) that themachine could handle. Examples of these oscillations areshown in the 1898 paper6 by Michelson and Stratton. Thephenomenon had, however, already been observed and es-sentially explained by the English 'mathematician HenryWilbraham 50 years earlier7 in correcting a remark byFourier on the convergence of Fourier series. It might bemore appropriate to call it the Wilbraham-Gibbs phenom-enon than the Gibbs phenomenon.

The first extensive generalization of the Gibbs phenome-non, including the conditions for its existence, was pro-vided by the mathematician Bacher in 1906 (Ref. 8). Boththis treatment and those in subsequent mathematical trea-tises on Fourier series9 are at an advanced level, usuallyunsuitable for physics students. In the following we consid-er by a method accessible to physics and engineering stu-dents the problem of Fourier series for functions with dis-continuities, The method is rigorous; it contains theessence of the mathematical treatments without their com-plexity; and it discusses how to estimate the overshoot nu-merically.

The presentation is organized as follows. In Sec. II ageneralization of the sawtooth function is made, to include

@ 1992 American Association of Physics Teachers 425

Page 2: Fourier series and the Gibbs phenomenon - Semantic Scholar · discontinuity-a commonsense result. Notice that in the above we took the limit in x, then we examined the limit of the

in a single formula the conventional sawtooth, the square-pulse, and the wedge functions. Their Fourier amplitudescan be calculated readily from the Fourier-series formulathat we then derive. This formula provides the startingpoint for understanding the Gibbs phenomenon in Sec. III.The Appendix gives enough detail on the numerical meth-ods used to estimate the overshoot values that students canreadily make the calculations themselves.

II. FOURIER SERIES FOR THE GENERALIZEDSAWTOOTH

The generalized sawtooth function that we introduce issketched in Fig. 1(a) and is defined by

Y(X)=1-(1T-X)SL' O<X<1T,

= 1-D+ (X-1T)SR' 1T<x<21T, (1)

in terms of the slopes on the left- and right-hand sides of thediscontinuity SL and SR and the extent of the discontinuityD. From this definition we obtain several functions whose

Fourier series are commonly investigated by physicists andengineers, namely; the square pulse has SL == SR = 0,

D = 2; the wedge that starts and ends with Y = 0 hasSL = - SR = 1/1T,D = 0; the conventional sawtooth withthe same end points has SL = SR = 1/ 1T, D = 2. There isalsoan implieddiscontinuityof 1T(SR- SL) - D at x = 0or 21T,which will produce another overshoot. It is sufficientfor our discussion to consider only the discontinuity atx= 1T.

A function and its Fourier amplitudes are related by

y(x) ::::YM(X), (2)where the Fourier series to M terms is

M

YM(X) = I [ak cos(kx) +bk sin(kx)]. (3)k=O

y

x

(a)

o

(b)5 R

dydx

x

Fig. I. The generalized sawtooth function, Eq. (I),' \lsed to discuss theGibbs phenomenon. The solid lines in (a) show the function and in (b)

they show its derivative with respect to x.

426 Am. J. Phys., Vol. 60, No.5, May 1992

For our purposes the Fourier amplitudes ak and bk canmost conveniently be obtained from

ak = Re [Ck ]/ (1 + 8k,O ), bk = 1m[cd (4)

in terms of the complex Fourier coefficients Ckgiven by

1211' dxy(x)e-ikx

Ck = . (5)o 1T

Recall that the Fourier amplitudes, for given M, providethe best fit (in the least-squares sense) of an expansion ofthe type Eq. (3) to the function y. Therefore, attempts tosmooth out the Gibbs phenomenon by applying dampingfactors necessarily worsen the overall fit. This fact is oftenforgotten3 and needs to be recalled.4

With these preliminary remarks, we are ready to calcu-late the Ck in Eq. (5). For k = 0 we obtain, as always, thatao = CO,the average value ofY in the interval of integration,namely

ao=1-D/2+1T(SR-sd/4. (6)

For k> 0 the integrals indicated in Eq. (5) can be per-formed directly by using elementary methods. Upon takingreal and imaginary parts of the result by inspection, thestudent will obtain

ak = (SR - SL) (1 - 1Tk)/1Tk 2, (7)

bD(1 - 1Td/1T - (SR + sd

k = (8)k

In these two equations the phase factor

1Tk = ei1Tk= ( - 1) k

has the property that

(9)

( 10)

which is useful in manipulating subsequent expressions.The formulas for the Fourier amplitudes of the general-

ized sawtooth, Eqs. (7) and (8), can be used directly togenerate the amplitudes for the common examples, thesquare pulse, the wedge, and the symmetric sawtooth. Theappropriate slope and discontinuity values are given at thebeginning of this section, or can be read off Fig. 1(a). Be-cause the integrations used to derive Eqs. (7) and (8) arejust those for each example when worked separately, wehave introduced a considerable labor-saving device for thestudent-assuming, of course, that the instructor's inten-tion in requiring so many examples to be worked is notdeveloping physics by mental gymnastics.

What is the value of the Fourier series right at the discon-tinuityx = 1T?It isobtaineddirectlyby usingx = 1Tin Eq.(3) with the ak values from Eq. (7) and the sine terms notcontributing. The result is simply

(.

) M k_ SR - SL.~. 1 - ( - 1)YM(1T)-ao- £.. .

1T k=1 k2

There are several interesting conclusions from this result.( 1) The Fourier series prediction at the discontinuity

depends on M in a way that is independent of the extent ofthe discontinuity D. (There is a simple dependence on D inthe average ao. )

(2) For any number of terms in the sum M if there is nochange of slope across the discontinuity (as for the squarepulse and conventional sawtooth), then the series value isjust the mean value of the function ao' For the square pulse,the usual example to illustrate the Gibbs phenomenon, the

(11 )

William J. Thompson 426

Page 3: Fourier series and the Gibbs phenomenon - Semantic Scholar · discontinuity-a commonsense result. Notice that in the above we took the limit in x, then we examined the limit of the

series value at the discontinuity is just the average of thefunction values just to the left and right of the discontin-uity, namely zero.

(3) The series in Eq. (11) is just twice the sum over thereciprocal squares of the odd integers not exceeding M.Therefore, it increases uniformly as M increases. This con-vergence is illustrated for the wedge function in Fig. 2. Thelimiting value of the series can be obtained in terms of theRiemann zeta function, as 3;(2)/2 = r/4. The Fourierseries then approaches

Thus, independently of the slopes on each side of the dis-continuity, the series tends to the average value across thediscontinuity-a commonsense result.

Notice that in the above we took the limit in x, then weexamined the limit of the series. The result is perfectly rea-sonable and well behaved. The surprising fact about theGibbs phenomenon, which we now examine, is that takingthe limits in the opposite order produces quite a differentresult.

III. THE GIBBS PHENOMENON

Now that we have examined a function with no discon-tinuity in value but only a discontinuity in slope, we directour steps to the study the value discontinuity. Consider anyx which is not at a point of discontinuity of y. The over-shoot function, defined by,

OM(x) =YM(X) -y(x) (13)

is then well defined, because both the series representationand the function itself are well defined. As we derived at theend of the last section, if we let x approach the point ofdiscontinuity with M finite, we get a commonsense result.Now, however, we stay near (but not at) the discontinuity.We will find that the value of OMdepends quite strongly onboth x and M. In order to distinguish between the usualoscillations of the series approximation about the functionand a Gibbs phenomenon, one must consider the behaviorof OMfor large M and identify which parts (if any) persistin this limit.

Fig. 2. Oscillation of the Fourier series for the wedge function, Eq. (13),shown for M = I (dotted curve), M = 3 (dashed curve), and M = 15

(solid curve). The function for M = 3 has been multiplied by 10, and for

M = 15 it has been multiplied by 100. The derivative of the function, butnot the function itself, has a discontinuity at x = 1T.

427 Am. J. Phys., Vol. 60, No.5, May 1992

For the generalized sawtooth shown in Fig. 1 we cansubstitute for the series the expressions Eqs. (3), (6 )-( 8),and for the function Eq. (1), to derive the explicit formulafor the overshoot function

where the trigonometric sums are

S_ =_ f (1-1Tk) cos(kx)k= I kM .

S + =2 L sm(kx)k= I k '

Sv= f (1 - 1Tk) sin(kx)k= I k

(15)

(16)

(17)

The signs in these definitions are chosen so that the func-tions are positive near x = 1T.

One may use Eqs. (14) through (17) to investigate theovershoot values directly as a function of the number ofterms in the Fourier series M and the values of x near thediscontinuityat x = 1T. The Appendixhas a discussionofsome numerical procedures for this. It is also interesting tosee what progress can be made analytically. In particular,for what value of x, say xM' does OM(x) have a maximumfor x near 1T?To investigate this question, let us do theobvious and calculate the derivatives of the terms in Eq.(14), which requires the derivatives of the trigonometricseries, Eqs. (15)-(17). We have

dS_ =Sv,dx

M

dS + = 2 L cos(kx),dx k= I

(18)

(19)

dSv =dx

M

L (1 - 1Tk) cos(kx).k=1

(20)

To evaluate the latter two series in closed form, we writethe cosine as the real part of the complex-exponential func-tion, then recognize that one has geometric series in powersof exp(ix), which can be summed by elementary means.Thus

dS+ = _ 1+ sin[(M+ 1I2)x] ,dx sin(x/2)

dSv = sin[(M + l)x]dx sin(x)

(21)

(22)

Since Sv is not known in closed form, there is probably nosimple way to evaluate the derivative of S _ in closed form.It will turn out that we do not need it subsequently.

Collecting the pieces together, we finally have the resultfor the derivative of the overshoot function at any x < 1T

William J. Thompson 427

0

OM(x)

-, 1(15) x100

;t

lit I I I

0 1 2 3 4 5 6x

Page 4: Fourier series and the Gibbs phenomenon - Semantic Scholar · discontinuity-a commonsense result. Notice that in the above we took the limit in x, then we examined the limit of the

dOM = (SR -SL) (1-_1- dS_ )dx 2 11' dx

(SR - sd sine (M + II2)x]2 sin(x/2)

+ D sin[(M + l)x] .11' sin(x)

This derivative is apparently a function of the independent-ly chosen quantities SR, SL' D, and M. Therefore, the posi-tion of the overshoot extremum (positive or negative)seems to depend upon all of these.

The only example that we considered in Sec. II that hadSR =l=sLwas the wedge, which was well behaved near x = 11'

because D = O.Figure 2 showsthe overshootfunctionforthe wedge, for three small values of M, namely, 1,3, and 15.For the wedge only the S _series, Eq. ( 15), is operative forOM' and this series converges as Ilk 2, rather than as Ilkfor the other series. Note the very rapid convergence,which improves about an order of magnitude between eachchoice of M. Clearly, there is no persistent overshoot.

For the square-pulse function, the common example fordisplaying the Gibbs phenomenon, SR = SL = 0, so that inEq. (23) the extremum closest to (but not exceeding) 11'will occur at

(23)

xM = 11'-11'/(M + 1). (24)

By differentiating the last term in Eq. (23) once more, itwill be found by the conscientious reader that the secondderivativeisnegativeat xM' sothisx valueproducesa max-imumofOM. Indeed, from Eq. (22) it is straightforward topredict that there are equally spaced maxima below x = 11'

with spacing 211'/(M + 1). Thus the area under each ex-cursion above the line y = 1 must decrease steadily as MIncreases.

The square-pulse overshoot behavior is shown in Fig. 3,in which we see the positive overshoot shrinking propor-tionally closer to 11'as M increases. By making numericalcalculations, as described in the Appendix, students willdiscover that the extent of the overshoot is also remarkablyindependent of M for the values shown, namelyOM(x M) = 0.179 to the number of figures shown. One wayto estimate this well-known 1.9-11 result for large M is givenin the Appendix. The fact that OMconverges to a nonzero

Fig. 3. Gibbs overshoots for the square pulse of unit amplitude, shown for

a range of values of the upper limit of the series sum, M.=<,31,63, 127, and255. The function (indicated by the horizontal segment) has a discontin-

uity (indicated by the heavy vertical segment) at x =<' 11".

428 Am. J. Phys., Vol. 60, No.5, May 1992

value for large M identifies this as a genuine overshoot, asdiscussed in the first paragraph of this paper and below thedefining Eq. (13).

The sawtooth function is our second example for theGibbs phenomenon. For this function we haveSR = SL = 1111',and D = 2. If these valuesare inserted inEq. (23) we find exactly the same position for the locationof the maximum overshoot, namely that given by Eq. (24).The amount of the overshoot also tends to the same magicvalue, 0.179, as one will discover by investigating the prob-lem numerically, as suggested in the Appendix. Otherproperties, such as the locations of the zero-overshoot posi-tions on either side of XM will be found to depend on theparameters determining the shape of y(x).

So, what's going on here, and have we been led along aprimrose path? According to Eq. (23), it looks as if thevalue of x M should depend on the shape of the functionwhose Fourier series we determine. But we discovered that,ifthere isadiscontinuity(D =1=0),there is no dependence ofits position or of the overshoot value on the shape of thefunction, at least for the two examples that we investigated.

The way to solve this puzzle is to take a different view ofthe original functiony(x), for example as given by Eq. (1).We may consider this as a linear superposition of a functionwith no discontinuities in its values, plus a constant (sayunity) broken by a drop of amount D at x = 11'.Since takingFourier series is a linear transformation, in that sums offunctions have Fourier amplitudes which are the sums ofthe amplitudes from each series separately, only the dis-continuous part gives rise to an overshoot in the limit oflargeM. Then the overshoot is at 11'/(M + 1) below x = 11',since it arises only from the discontinuity. Because of thesymmetry of the discontinuity, there will be a mirror un-dershoot in the opposite direction just above x = 11'.

The terms in Eq. (23) that do not involve SD are justfrom oscillations of the series about the function. Theseoscillations damp out for large enough M, as we saw for thewedge at the end of Sec. II. A very asymmetric wedge,having D = 0, SL> 0, SR < 0, but ISRI~SL' may be used tovery nearly reproduce the effects of a discontinuity. Suchdiscontinuities of derivatives produce slow convergence ofthe series, but they cannot cause the overshoot.

Our discussion is now complete: We conclude that, assoon as we have studied the square-pulse function that is allthere is to understand about the Gibbs phenomenon inFourier series.

APPENDIX: NUMERICAL METHODS

The numerical methods for investigating the Gibbs phe-nomenon in Fourier series are straightforward, but requirecare if a large number of terms M, is used in the series. Thisis because for x near 11',summation over terms containingsine or cosine of kx oscillate in sign very rapidly as k or xchanges.

I found that with the precision of my computer the val-ues of S + and SD were calculated accurately for M up toabout 300. Past this, even with the use of double-precisioncomputer arithmetic, unreliable results were produced. Inorder to make this claim, an alternative estimate of the sumis needed. Fairly elegant methods for summing the remain-der series and thereby estimating bounds on the overshootare given by, for example, SommerfeldlO and by Soly-mar. II We provide a simplified treatment as follows.

The definingEq. (17) for SD can be first replaced by

William J. Thompson 428

(31) (63) (127) (255)n__.... '" _ _" "'"'. t' /7'\. A

---- ' V \YM(x) I-

' ,". \ \, \

0.6 I- \. \ \'. \

\ \,,,

\\ \ \, ,0.2 I- ... ,\. \..\

I I I I I I \111:3.02 3.06 x 3.10 3.14

Page 5: Fourier series and the Gibbs phenomenon - Semantic Scholar · discontinuity-a commonsense result. Notice that in the above we took the limit in x, then we examined the limit of the

twice the summation over only odd values of k, then thissum can be approximated by an integral if M is large. Theresult can be converted to the integral

SD(X)ZrM-1)X' sint dt, (25)Jo t

wherex' = 1T- x. SincewewantSDevaluated at the peakvalue nearest to 1T,we set x to x M given by Eq. (24). Then,within a correction of order 1/M, the resulting integral is tobe evaluated with an upper limit of 1T.The integral in Eq.(25) can easily be done by expanding the sine function inits Maclaurin series, dividing out the t, then integratingterm by term, to obtain

i71' sin t(

ffl 1T4 1T6

)SD(XM)Z -dt=1T 1--+---+... .o t 3!3 5!5 7!7

(26)When the value of this integral summed out to 1T1Ois substi-tuted in the overshoot Eq. (14) for the square pulse, wefind that 0M(XM) = 0.179 to three significant figures, incomplete agreement with direct calculation of the seriesovershoot for both the square pulse and the sawtooth foundin Sec. III.

I For example,G. Arfken,MathematicalMethodsfor Physicists(Aca-demic, New York, 1970), 2nd ed., Chap. 14.5.

2 R. K. Lambert and R. C. O'Driscoll, "Fourier series experiment for theundergraduate physics laboratory," Am. J. Phys. 53, 874-880 (1985).

3 J. E. Harvey, "Fourier integral treatment yielding insight into the con-trol of Gibb's phenomenon," Am. J. Phys. 49, 747-750 (1981).

4R. P. Leavitt, "Comments on 'Fourier integral treatment yielding in-sight into the control of Gibb's phenomenon,'" Am. J. Phys. 51,80--81

(1983); J. Harvey, ibid, p. 81.SJ. W. Gibbs, "Fourier's series," Nature 59,200 (1898); Nature 59, 606

(1899): reprinted in The Collected Works of J. Willard Gibbs (Lay-mans-Green, New York, 1931), Vol. II, Part 2,258-260.

6 A. A. Michelson and S. W. Stratton, "A new harmonic analyser," Phil.Mag. 45,85-91 (1898).

7H. Wilbraham, "On a certain periodic function," Cambridge DublinMath. J. 3, 198-201 (1848).

8 M. B6cher, "Introduction to the theory of Fourier's series," Ann. Math.7,81-152 (1906), Sec. 9.

"For example, ~. Zygmund, Trigonometric Series (Cambridge U.P.,Cambridge, 1959), 2nd ed., p. 61; P. L. Walker, The Theory of Fourier

Series and Integrals (Wiley, Chichester, 1986), Chap. 2.3.10A. Sommerfeld, Partial Differential Equations in Physics (Academic,

New York, 1949), Sec. 2.

II L. Solymar, Lectures on Fourier Series (Oxford U.P., Oxford, 1988),

Appendix.