Vous êtes sur la page 1sur 9

fourier11.

mcd

page 1

Introductory Explorations of the Fourier Series


by Theresa Julia Zielinski Department of Chemistry, Medical Technology, and Physics Monmouth University West Long Branch, NJ 07764-1898 tzielins@monmouth.edu

Copyright Theresa Julia Zielinski 1996-2005 . All rights reserved. You are welcome to use this document in your own classes but commercial use is not allowed without the permission of the author.
Goal of this exercise : To give students the opportunity to efficiently and effectively practice using a Fourier Series Expansion. This exercise serves as a foundation for future work in quantum mechanics where linear combinations of atomic orbitals and expressions of solutions to the Schrodinger Equation are written as expansions using sets of functions that are complete orthonormal sets. Prerequisites : 1. A basic understanding of Mathcad including drawing graphs of functions. 2. Integral calculus, summations, trigonometric functions. 3. Be able to distinguish between even and odd functions. 4. Ability to use a Mathcad document as a template for extension of the exercise. 5. Introductory lectures on Fourier series or textbook readings on the topic. (This document is annotated to assist the novice Mathcad user.) Objectives: At the end of the lesson you will be able to: 1. express a simple function as a Fourier Series. 2. compute the Fourier coefficient for the first few terms in an expansion. 3. prepare graphical representations of the original function and the Fourier fit to that function. 4. discuss the principles underlying a Foruier expansion.

Creation Date: July 24, 1996 Modified: October 12, 2003

fourier11.mcd

Author: Theresa Julia Zielinski page 1

fourier11.mcd

page 2

Background: In physical sciences we often express functions as series. Power series are very common, for example the Taylor series. Another important series is the Fourier series. The Fourier series is a trigonometric series, a sum of sine and cosine terms. The Fourier series is important because certain functions that cannot be expanded as a Taylor series can be expanded instead using a Fourier series. The Fourier series is also the prefered series for representing periodic functions. Examples of periodic functions include harmonic oscillators, rotors of various kinds, pendulums, etc. Since the Fourier series is a sum of sine and cosine terms it is essentially a periodic series. More generally we can say that the Fourier series is an expansion of a periodic function, f(x), with a uniformly convergent series, i.e. a sum of sine and cosine terms, in a range from 'a' to 'b' where x is greater than or equal to 'a' and less than or equal to 'b'. For a range [a,b] that is symmetric about zero, if f(x) is an even function, f(-x) = f(x), then only cosine terms contribute to the sum and if f(x) is an odd function, f(-x) = -f(x), then only sine terms contribute to the sum. A series is uniformly convergent for a function f(x) if, in a given interval, the series equals f(x) for every value of x in the interval. Expansions of a function as an infinite series like this are only possible because the sine and cosine functions form a complete orthonormal set of functions that fully span the space of the periodic function that they are being used to approximate. Mathematically the orthonormal property is expressed as:

sci ( x) scj ( x) dx := ij a

(note: this equation is toggled off)

where sci is either the sine(ix) or cosine(ix) and sc j is either sine(jx) or cosine(jx) and i,j is the Kronecker delta. i,j = 1 when i is equal to = j = 0 when i is not equal to j

Creation Date: July 24, 1996 Modified: October 12, 2003

fourier11.mcd

Author: Theresa Julia Zielinski page 2

fourier11.mcd

page 3

The following expressions are useful in derivations of the coefficients of the terms in a Fourier series. These expressions are toggled off in this part of the document.

sin ( n x) dx = 0 cos ( n x) dx = 0
= 2 n=0

n = 0, 1, 2, 3,....

n = 1, 2, 3, .....

cos ( m x) sin ( n x) dx = 0 m = 0, 1, 2, 3,.... and n = 0, 1, 2, 3,....... cos ( m x) cos ( n x) dx = 0 m not equal to n sin ( m x) sin ( n x) dx = 0
= = m = n not equal to 0 m not equal to n

m = n not equal to 0

Creation Date: July 24, 1996 Modified: October 12, 2003

fourier11.mcd

Author: Theresa Julia Zielinski page 3

fourier11.mcd

page 4

The general equations for Fourier series expansions are shown here. Notice the use of a and b for the coefficients for the cos and sin terms respectively. Here F(x) is the function that is to be fit by the Fourier series. In the sections that follow you will be led through a series of exercises that will put into practice the Fourier series method for both odd and even functions.

F(x) = some function of x f (x) =


= 1
1 a 0 + a n cos ( n x ) + b n sin ( n x ) 2 n=1 n=1

Many of the equations in this document were created with Mathtype and thus are not active equations. When you click on such equations a text box surround will appear.

an

F(x) cos ( n x ) dx

n = 0, 1, 2, ....

bn

2 L

F(x) sin ( n x ) dx

n = 1, 2, 3, ....

for even functions we have:

an =

F(x)cos(n x)dx
0

n = 0, 1, 2, ......

bn = 0

For odd functions we have:

bn =

F(x)sin(n x)dx
0

an = 0
These expressions for a and b assume that the integrals exist and that F(x) is a continuous function. For piecewise regular functions, each continuous component of the function must be determined separately.

Creation Date: July 24, 1996 Modified: October 12, 2003

fourier11.mcd

Author: Theresa Julia Zielinski page 4

fourier11.mcd

page 5

Let us start with a simple Fourier expansion for a periodic function, a simple step function. When you work with this document do not repeat the exercises using the same variable names. This will confuse Mathcad and give you a headache trying to debug your Mathcad code. -1 = 1 0 < x <,= - =,< x < 0

F ( x)

Defining the step function (inactive here but active below).

Plotting the step function.

F ( x) := x G ( x) := if ( x 0 , F ( 1) , 0) GG ( x) := if ( x 0 , F ( 1) , 0)
2

G ( x) + GG ( x)

10

0 x

10

Setting up the Fourier expansion. x is defining the range for the calculation.

x := , 3.1 .. j := 0 .. N

N can equal 0 up to any large integer. Notice the relationship between N and i Notice the way the range of x is defined.

Values of N are entered below just above the N 4 1 graph. The entry point for this integer was placed f ( x) := sin [ ( 2 j + 1 ) x ] so as to make exploration and graphical there 2 j + 1 insights possible without excessive scrolling of j = 0

the screen view. N is a Mathcad Global variable in this document. Depending on how you have your worksheet options set a change in N will immediately result in a new figure or you may need to press F9 to do do the calculations that will show a new figure. This can also be accomplished by pressing the = sign in the first tool bar of the window.

Creation Date: July 24, 1996 Modified: October 12, 2003

fourier11.mcd

Author: Theresa Julia Zielinski page 5

fourier11.mcd

page 6

N 1
2 1 f ( x) GG ( x) + G ( x) 0 1 2

0 x

Vary N, the number of terms in the expansion and describe the consequences as N is increased to a large number. Record your observations in your notebook. Note how the Fourier series behaves relative to the step function it is designed to match. Concisely express the function that is being expressed by the series expansion shown above. This means to write out explicitly the first few terms in the series for the fitting function.

Creation Date: July 24, 1996 Modified: October 12, 2003

fourier11.mcd

Author: Theresa Julia Zielinski page 6

fourier11.mcd

page 7

Sample Problem: Expand the function F(x)=x in the interval - to by a Fourier series. Solution: This function is an odd function. Only sine terms will show up in the expansion. 1. First we write the function and set the interval for the expansion. 2. Then we choose an upper limit for the number of terms in the expansion (the value for M). Explorations on the effect of changing the upper limit are easily implemented by just changing the value for M. M is a global variable and is placed below just above the graph.

F ( x) := x x := , 3.0 .. n := 0 .. M

3. Next we have the integral for Bn. In this integral note the 1 Bn := F ( x) sin ( n x) dxpresence of the function F(x). Any odd function can be used here. n is the index used to identify the integrals in the

expansion for the fitting process. Using M and n makes possible a more general exploration of the series in the area below. Ask Mathcad to show several of the B n coefficients in the Fourier expansion for the function given here. Comment on their magnitude and the significance of the magnitude as n increases. Write out the expression that would correspond to the coeficients for the cosine terms in a Fourier series expansion of this function. Show that several of these An coefficient values are in fact zero. 4. We wrote f(x) here instead of F(x) so as to prevent Mathcad from overwriting our original function. We will compare the fourier series fit, f(x), of the function to the function, F(x), itself as an exercise. Now write out by hand f(x) as the sum of several terms. Use at least four terms in your answer.

f ( x) :=

(Bn sin ( n x) )

= 1

Creation Date: July 24, 1996 Modified: October 12, 2003

fourier11.mcd

Author: Theresa Julia Zielinski page 7

fourier11.mcd

page 8

Notice M is an upper limit in the sum shown above. Varying M allows rapid and efficient exploration of the effect of increasing number of terms in a Fourier expansion.

M 5

4 2 f ( x) F ( x) 0 2 4

0 x

Notice the dips and humps in the Fourier curve. The Fourier fit overshoots the function f(x)=x . This is known as the Gibbs Phenomenon. The Gibbs phenomenon remains even at higher values of N and is most noticeable at the ends of the range for the fit. Explore the fitting process by varying N and recording your observations. Follow this example to examine another odd function, f(x)=x 3 . This should take no more than a few minutes to implement. If you choose to retype the various parts of the template, do not use the same names for functions. This makes Mathcad very unhappy and the results are unpredictable.

Creation Date: July 24, 1996 Modified: October 12, 2003

fourier11.mcd

Author: Theresa Julia Zielinski page 8

fourier11.mcd

page 9

Exercise : For several values of M compute and compare the numerical value of F(x) to the f(x) predicted by the Fourier series at x = pi and at x = zero. record your observations. What will the calculated Fourier series value for f(x) always be at x = + pi or x = - pi ? What will the value of F(x) always be at at x = + pi or x = - pi ? (Hint: Type f() = and see what you get. Also Look at the graphs and the calculated values you obtained.) .

Mastery Level Exercise Demonstrate that you understand this material by expressing the function f(x) = x 2 with a Fourier series over the interval x . Test your model by using it with one other even function. This is an even function so be careful about what you use in the Fourier expansion. Create space below to complete this assignment.

Acknowledgment: Partial support for this work was provided to TJZ by the National Science Foundation's Division of Undergraduate Education through grant DUE #9354473 and by the New Traditions project at the University of Wisconsin - Madison through the National Science Foundation's Division of Undergraduate Education through grant DUE #9455928. TJZ also thanks George Hardgrove of St. Olaf College for the square wave expansion that lead to the development of this document.

Creation Date: July 24, 1996 Modified: October 12, 2003

fourier11.mcd

Author: Theresa Julia Zielinski page 9

Vous aimerez peut-être aussi