periodic function 666

15
College of Engineering and Computer Science Mechanical Engineering Department Mechanical Engineering 501B Seminar in Engineering Analysis Spring 2009 Class: 14443 Instructor: Larry Caretto February 2 Homework Solutions 1. Using example 2 on page 212 of Kreyszig, find the first few terms of the Fourier-Legendre series for cos(x/2) and plot the given function and the first few partial sums. Show the details of your work. In the Fourier-Legendre series, we expand an arbitrary function, f(x) in terms of the Legendre polynomials, P m (x). This series has the form given in example 2 on page 212 of Kreyszig. The formula for a m includes the normalization required for the Legendre polynomials. The general equation for the Legendre polynomial is given by equation (11) on page 180 of Kreyszig. This equation is shown below. Here the upper limit on the sum, M = n/2 if n is even or (n + 1)/2, if n is odd. The first few polynomials are given on page 180 as follows: P 0 = 1, P 1 = x, P 2 = 1.5x 2 – 0.5, P 3 = 2.5x 3 – 1.5x, P 4 = 4.375x 4 – 3.75x 2 + 0.375, and P 5 = 7.875x 5 – 8.75x 3 + 1.875x. We can use the general formula above to find P 6 (X) We can use these polynomials and the formula for a m to compute the a m coefficients for the first seven polynomials as follows. Jacaranda (Engineering) 3333 Mail Code Phone: 818.677.6448 E-mail: [email protected] 8348 Fax: 818.677.7062

Upload: arif-nec

Post on 09-Jul-2016

216 views

Category:

Documents


0 download

DESCRIPTION

Periodic Function

TRANSCRIPT

Page 1: Periodic Function 666

College of Engineering and Computer ScienceMechanical Engineering DepartmentMechanical Engineering 501B

Seminar in Engineering AnalysisSpring 2009 Class: 14443

Instructor: Larry Caretto

February 2 Homework Solutions

1. Using example 2 on page 212 of Kreyszig, find the first few terms of the Fourier-Legendre series for cos(x/2) and plot the given function and the first few partial sums. Show the details of your work.In the Fourier-Legendre series, we expand an arbitrary function, f(x) in terms of the Legendre polynomials, Pm(x). This series has the form given in example 2 on page 212 of Kreyszig. The formula for am includes the normalization required for the Legendre polynomials.

The general equation for the Legendre polynomial is given by equation (11) on page 180 of Kreyszig. This equation is shown below. Here the upper limit on the sum, M = n/2 if n is even or (n + 1)/2, if n is odd.

The first few polynomials are given on page 180 as follows: P0 = 1, P1 = x, P2 = 1.5x2 – 0.5, P3 = 2.5x3 – 1.5x, P4 = 4.375x4 – 3.75x2 + 0.375, and P5 = 7.875x5 – 8.75x3 + 1.875x. We can use the general formula above to find P6(X)

We can use these polynomials and the formula for am to compute the am coefficients for the first seven polynomials as follows.

The cosine is an even function. That is, cos(-x) = cos(x). The Legendre polynomials with odd subscripts are odd functions. They contain only odd powers of x such that P2n+1(-x) = -P2n+1(x). One can show that the integral of an odd function times an even function over a symmetric interval is zero. Thus all the am terms, for odd m, will be zero. We can apply our general equation for am to compute a2, a4 and a6.

Jacaranda (Engineering) 3333 Mail Code Phone: 818.677.6448E-mail: [email protected] 8348 Fax: 818.677.7062

Page 2: Periodic Function 666

The equations for a2 to a6 contain the integral , where k in an integer. The evaluation of these integrals, using direct integration and MATLAB commands is shown in the Appendix to these solutions. The results are:

Using these results in the expressions for a0 to a6 gives the following results a0 = 0.636619772368, a2 = -0.687085270146029, a4 = 0.0517789536762434, and a6 = -0.00133045638573762; recall that all am with odd subscripts are zero. We can now evaluate the first few terms in the sum for the Fourier-Legendre series for cos(x/2). The results are plotted on the next page. The series is seen to provide a good approximation to the cosine function even with only three terms in the series.

2. Fourier-Bessel series, refer to Example 3 on page 213 of the text. Take n = 0 and R = 1, so that we get the series f(x) = a1J0(10x) + a2J0(20x) + a3J0(30x) +… .where k0 is the kth zero of the Bessel function, J0(x), defined such that J0(k0) = 0. Take f(x) = 1 and evaluate the integrals required to compute an analytically by using equation (24) on page 194 with = 1. Plot the first few partial sums on common axes. The required values for the zeros of J0 can be downloaded from the course web site.From equation (10) in example 3 on page 213, we find the following equation for the coefficients, am in the Fourier-Bessel series.

Jacaranda (Engineering) 3333 Mail Code Phone: 818.677.6448E-mail: [email protected] 8348 Fax: 818.677.7062

Page 3: Periodic Function 666

(Note that this equation is based on an arbitrary value for R; in this problem we have R = 1 so that mn = kmnR is the same as kmn, the tabulated zeros of the Bessel function of order n. We will complete the derivation of am for arbitrary R, however.) In this problem we have n = 0 and f(x) = 1. This gives the following equation for am.

Equation (24) on page 194 states that . Setting = 0, multiplying by

dx, replacing x by kmox, and integrating both sides of the result from x = 0 to x = R gives the integral of an exact differential on the left. We can then evaluate the function that is differentiated between the limits of x = 0 and x = R to obtain a value for the integral on the right.

We can use this result to evaluate am, using the relationship that km0R = m0 in the final steps.

Thus, our Fourier-Bessel series for f(x) = 1 becomes

Jacaranda (Engineering) 3333 Mail Code Phone: 818.677.6448E-mail: [email protected] 8348 Fax: 818.677.7062

Page 4: Periodic Function 666

The partial sums with one, two, five, ten, and 25 terms are shown in the figure below. We see that taking additional terms gets the series closer to one, but there is still an oscillation around f(x) = 1 even for 50 terms.

3. Show that the functions 1, x, x2 – 1/3, and x3 – 3x/5 are orthogonal on the intgeral –1 x 1. Determine the orthonormal set of functions.To show orthogonality we have to show that the integral of all unlike pairs of functions over the interval is zero. We evaluate this integral for all possible pairs below.

Jacaranda (Engineering) 3333 Mail Code Phone: 818.677.6448E-mail: [email protected] 8348 Fax: 818.677.7062

Page 5: Periodic Function 666

Note that we do not have to perform the first, third, fourth and sixth integrals. Each of these is the integral of an odd function – actually the product of an even function times an odd function, which is an odd function – over an interval that is symmetric about zero. Such integrals are known to be zero.

To obtain the normalized eignefunctions we compute the norm for each eignefunction and divide the eignefunctions above by the square root of the norm. First we compute the norms for each eignefunction.

Dividing each of the eignefunctions by the square root of the norms just found gives the following set of orthonormal eigenfunctions.

Jacaranda (Engineering) 3333 Mail Code Phone: 818.677.6448E-mail: [email protected] 8348 Fax: 818.677.7062

Page 6: Periodic Function 666

4. Find the Fourier series of f(x) = 3x2 as a periodic function over the region –1 < x < 1 (p = 2L = 2). Sketch f(x) and find the first three partial sums.

Since x2 is an even function over this interval, we can use a Fourier series with only cosine terms. From equation (6) on page 487, the coefficients in this Fourier series are given by the following equations.

Plugging in L = 1 and f(x) = 3x2, gives

For integer n, sin(n) = 0 and cos(n) = 1 if n is even and –1 if n is odd. Thus, we have the expression for an and the Fourier series for 3x2 shown below.

A plot of this series over the region –3 x 3 is shown below.

The series is defined for the region –1 x 1; extending it beyond this region gives a periodic repetition caused by the Fouries series. The actual function, f(x) = 3x2 is only represented

Jacaranda (Engineering) 3333 Mail Code Phone: 818.677.6448E-mail: [email protected] 8348 Fax: 818.677.7062

Page 7: Periodic Function 666

accurately in the region for which it is defined. The effect of various terms in the series is shownin the figure on the next page. As the number of terms increase, the series gets closer to the actual function near the center of the region, but there is a discrepancy in the fit near the boundaries of the region.

5. Find the Fourier cosine series as well as the Fourier sine series for f(x) = x2. Sketch f(x) and its two periodic extensions. (Show the details.)

The coefficients for a Fourier series, over a half-interval, with only cosine terms are found from equation (2) on page 491.

For f(x) = x2, the equations for a0 and an give.

For integer n, sin(n) = 0 and cos(n) = 1 if n is even and –1 if n is odd. Thus, we have the expression for an and the Fourier cosine series for x2 shown below.

Jacaranda (Engineering) 3333 Mail Code Phone: 818.677.6448E-mail: [email protected] 8348 Fax: 818.677.7062

Page 8: Periodic Function 666

The formula for the sine series coefficients is given by equation (4) on page 4912.

For f(x) = x2, this equations gives.

In this equation, cos(0) = 1 and, for integer n, sin(n) = 0 and cos(n) = 1 or –1 for even or odd n, respectively. We can write cos(n) = (-1)n and obtain the following expression for bn. and the Fourier series for x2.

We can rewrite both the cosine and sine series in terms of the dimensionless variable, = x/L defined over the region –1 1.

The cosine series is exactly one/third the series obtained for 3x2, defined over the region –1 x 1 in problem 4 above. Thus this series will have the same behavior shown in the plot for that problem. Even though the series was only defined for 0 x L (for 0 1) the symmetrical behavior of the cosine about zero gives the correct result for values of x between –L and 0. However, the periodic nature of the Fourier series gives the periodic repetition of the parabola between -1 1 (-L x L). The sine series does not have the correct behavior around zero and it results in the plot shown below.

6. Find the complex Fourier series of f(x) = x2 over the region – < x < . Show the details of your work.

For the given region of – < x < the complex Fourier series and its coefficients are given by equation 6 on page 497.

Jacaranda (Engineering) 3333 Mail Code Phone: 818.677.6448E-mail: [email protected] 8348 Fax: 818.677.7062

Page 9: Periodic Function 666

100 Terms of Fourier Sine Series for f(x) = x2

-1.0

-0.8

-0.6

-0.4

-0.2

0.0

0.2

0.4

0.6

0.8

1.0

-2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0

x

f(x)

FourierExact

Substituting f(x) and using integration by parts two times gives the final result for cn.

From the Euler formula, eix = cos(x) + i sin(x), we have ei = cos( + i sin(),= -1 and e-i = cos(-+ i sin(-),= -1. Because of this ein = (ei)n = (-1)n. With this substitution, the expression for cn can be written as follows.

With this result the final complex Fourier series for f(x) = x2 can be written as follows.

Jacaranda (Engineering) 3333 Mail Code Phone: 818.677.6448E-mail: [email protected] 8348 Fax: 818.677.7062

Page 10: Periodic Function 666

Appendix – Integrals required for Problem 1

We find the following integral, using integration by parts. If we define u = xn so that du = nxn-1, and dv = cos(ax)dx, so that v = sin(ax)/a, the usual formula for integration by parts ( ) gives the following result.

We can use a similar process of integration by parts to evaluate the integral with the sine term. This gives the following result.

Combining these two results gives the following expression for .

The final result above can usually be found in an integral table. If we have a definite integral with symmetric limits about x = 0 the integral of will be an integral of an odd function times an even function if n is odd. Such symmetric integrals will be zero. If we replace n by 2m to represent even powers we can write a symmetric integral from –b to b as follows.

We can evaluate the integrated terms between the limits of –b and +b using the relations that sin(-ab) = -sin(ab), cos(-ab) = cos(ab), (-b)2m = b2m, and (-b)2m-1 = -b2m-1.

This gives the following result.

Jacaranda (Engineering) 3333 Mail Code Phone: 818.677.6448E-mail: [email protected] 8348 Fax: 818.677.7062

Page 11: Periodic Function 666

In the solution to problem 5, page 246 we have integrals of the form . This is

the integral we just evaluated with b = 1 and a =/2. (This also gives ab = /2.) Thus, the desired integral has the following formula.

The sine and cosine of /2 are, respectively, one and zero, so that

The simple integral can be evaluated as follows.

We can use this integral and subsequent results to obtain the following integrals, using the

general formula for .

These integrals can be evaluated using the symbolic mathematics toolbox of Matlab. The required commands and results, using the educational version, are shown below. Commands entered by the user follow the “EDU>>” prompt. The remaining text is program output. The initial command, syms x, defines x as a symbolic variable. The following command, format long e, sets the appearance of the output. The remaining commands, which are used to find the integral

Jacaranda (Engineering) 3333 Mail Code Phone: 818.677.6448E-mail: [email protected] 8348 Fax: 818.677.7062

Page 12: Periodic Function 666

, have the form int(f(x),a,b), where f(x) is a Matlab string expression for the integrand

and a and b are the lower and upper limits respectively. The symbolic expression in the answer, ans, is then evaluated by the command double(ans).

EDU>> syms xEDU>> format long e

EDU>> int(cos(pi*x/2),-1,1) ans = 4/pi EDU>> double(ans)

ans =

1.273239544735163e+000

EDU>> int(x^2*cos(pi*x/2),-1,1) ans = 4*(pi^2-8)/pi^3 EDU>> double(ans)

ans =

2.411904428727790e-001

EDU>> int(x^4*cos(pi*x/2),-1,1) ans = 4*(pi^4+384-48*pi^2)/pi^5 EDU>> double(ans)

ans =

1.002298892908609e-001

EDU>> int(x^6*cos(pi*x/2),-1,1) ans = 4*(pi^6+5760*pi^2-120*pi^4-46080)/pi^7 EDU>> double(ans)

ans =

Jacaranda (Engineering) 3333 Mail Code Phone: 818.677.6448E-mail: [email protected] 8348 Fax: 818.677.7062

Page 13: Periodic Function 666

5.459022242030317e-002

Jacaranda (Engineering) 3333 Mail Code Phone: 818.677.6448E-mail: [email protected] 8348 Fax: 818.677.7062