You are on page 1of 13

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, 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.
1

f ( x) a m Pm ( x )

where a m

m0

2m 1
f ( x) Pm ( x)dx
2 1

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.

Pn ( x)

(1)

m0

( 2n 2m)!
x n2m
2 m!(n m)!(n 2m)!
n

The first few polynomials are given on page 180 as follows: P 0 = 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)

P6 ( x )

(1)

m0

(12 2m)!
1 12! 6
10! 4
8!
6! 0
x 62 m
x
x
x2
x

64m!(6 m)!(6 2m)!


64 0!6!6!
1!5!4!
2!4!2!
3!3!0!
P6 ( x )

1
924 x 6 1250 x 4 420 x 2 29
64

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

2(0) 1
1
1 2
x
x
a0
cos
P0 ( x )dx cos
(1)dx

2
2 1
2
2
2
1
1

x
sin 2

2


sin 2 sin 2

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 P 2n+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


E-mail: lcaretto@csun.edu

Mail Code
8348

Phone: 818.677.6448
Fax: 818.677.7062

2
2(2) 1
5
1
15
5
x
x 3 x
x
x
a2
cos
P
(
x
)
dx

cos
dx
x 2 cos

dx cos
dx
2

2
2 1
2
4 1
4 1
2
2 2
2
2
1
1

4
2(4) 1
9
30 x 2 3
x
x 35 x
a4
cos
P
(
x
)
dx

cos

dx

2
2
2 1 2 8
8
8
1
1

315
270
27
x
x
x
x 4 cos
x 2 cos
cos
dx
dx
dx

16 1
16 1
16 1 2
2
2
1

6
2(6) 1
13
1250 x 4 420 x 2 29
x
x 924 x
a6
cos
P
(
x
)
dx

cos

dx
2
2
2 1
64
64
64
2 64
1
1

12012
16250
5460
377
x
x
x
x
x 6 cos
x 4 cos
x 2 cos
cos
dx
dx
dx
dx

128 1
128 1
128 1
128 1
2
2
2
2
1

2k

x
cos
dx
2
, where k in an integer. The

The equations for a2 to a6 contain the integral 1


evaluation of these integrals, using direct integration and MATLAB commands is shown in the
Appendix to these solutions. The results are:

4
x
2
dx 3 8 0.2411904428 727790

1
1

1
1

cos

4
x
4
2
cos
dx 5 48 384 0.1002298892908609

4
x
6
4
2
cos
dx 7 120 5760 46080 0.05459022242030317

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 J 0
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.

am
Jacaranda (Engineering) 3333
E-mail: lcaretto@csun.edu

R 2 J n21 ( mn ) 0

xf ( x) J n (k mn x)dx

Mail Code
8348

Phone: 818.677.6448
Fax: 818.677.7062

(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.
R

am

2
x(1) J 0 (k m 0 x) dx
2 2
R J 1 ( m 0 ) 0

Fourier-Legendre Series for cos( x/2)


1
0.9

Partial sum s

0.8
0.7

Function

0.6

1 term

0.5

2 term s

0.4

3 term s
4 term s

0.3
0.2
0.1
0
-1

- 0.8

- 0.6

- 0.4

- 0.2

0.2

0.4

0.6

0.8

Equation (24) on page 194 states that

d
x J ( x) x J 1 ( x) . Setting = 0, multiplying by
dx

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.
R

1
1
d (k m 0 x) J 1 (k m 0 x) k m 0 xJ 1 (k m 0 x) 0 k m 0 RJ 1 (k m 0 R) (k m 0 x) J 0 (k m 0 x)d (k m 0 x)
R

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

2
2
1
am 2 2
xJ 0 (k m 0 x)dx 2 2
k m 0 xJ 0 (k m 0 x)d (k m 0 x)

R J 1 ( m 0 ) 0
R J 1 ( m 0 ) k m2 0 0

2 J 1 (k m 0 R )
2 J 1 ( m 0 )
2
1
2
k m 0 RJ 1 (k m 0 R)

2
2
2
R J ( m 0 ) k m 0
k m 0 RJ 1 ( m 0 ) m 0 J 1 ( m 0 ) m 0 J 1 ( m 0 )
2

2
1

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

Jacaranda (Engineering) 3333


E-mail: lcaretto@csun.edu

Mail Code
8348

Phone: 818.677.6448
Fax: 818.677.7062

m0 x
2J 0
R
2 J 0 (k m 0 x)

f ( x) 1 a m J 0 ( m 0 x)

m 1
m 1 m 0 J 1 ( m 0 )
m 1 m 0 J 1 ( m 0 )

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.
Bessel Function Expansion for f(x) = 1
1.6

1.4

1.2

1 term s

2 term s
3 term s

0.8

10 term s

0.6

50 term s

0.4

0.2

0
0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

Series Partial Sum

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.
1

x2

(1)( x)dx

x3 x
2 1
(
1
)
x

dx


3
3 3
1
1

1 1 1 1

0
3
3 3 3

x 4 3x 2
3 3x
(
1
)
x

dx


5
10
4
1

x4 x2
2 1
(
x
)
x

dx


3
6
4
1

Jacaranda (Engineering) 3333


E-mail: lcaretto@csun.edu

1 1
0
2 2

1 3 1 3

0
4 10 4 10

1 1 1 1
0
4 6 4 6

Mail Code
8348

Phone: 818.677.6448
Fax: 818.677.7062

x5 x3
3 3x
(
x
)
x

dx


5
5
5
1
1

1 1 1 1
0
5 5 5 5

1
5 x 3 3x 3 x
x 6 x 4 3x 4 x 2
1 3 3x

dx

dx

3
5
3
5
5
20 10
6 12
1
1
1

1 1
3
1 1 1
3
1

0
6 12 20 10 6 12 20 10
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.
1

(1)(1)dx x

1
1

1 ( 1) 2

x3
(
x
)(
x
)
dx

3
1
1

2
1 1

3
3
3

4 2x 2 1
x5 2x3 x
1 2 1

dx

dx

3
3
3
9
9
9
5
1
1
1

1 2 1 1 2 1
2 2
8


9
9
5 9 45
5 9 9 5

6 6x 4 9x 2
x 7 6 x 5 3x 3
3x

dx

dx

5
5
25
25
25
7
1
1
1

1 6
3 1 6 3
2 6
50 42
8


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

1
2

Jacaranda (Engineering) 3333


E-mail: lcaretto@csun.edu

3
x
2

45 2 1
x
8
3

Mail Code
8348

175 3 3 x
x
8
5

Phone: 818.677.6448
Fax: 818.677.7062

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.

1
nx
a n f ( x) cos
dx
L L
L

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

1
3 x3
2
a0
3
x
dx

2(1) 1
2 3
1

3 1 1

1
2 3
3

1
x2

1
2x
2
nx
2
an
3
x
cos
dx

3
sin nx
cos nx
sin nx

2
3

(1) 1
n
n
1
n

(1) 2
2(1)
2
2(1)

3
sin n
cos
n

sin
n

3
sin n
cos n

2
3
n
n
n 2
n

1
6 sin n 12 cos n 12 sin n

sin n

3
n
n
n 2
n 3

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.

an

12( 1) n
n 2

12( 1) n
cos(nx)
2
n 1 n

x2 1

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


Fourier Series for f(x) = 3x2 (100 term s)
3
2.5

f(x)

2
1.5
1
0.5
0
-3.0

-2.5

-2.0

-1.5

-1.0

-0.5

0.0

0.5

1.0

1.5

2.0

2.5

3.0

Jacaranda (Engineering) 3333


E-mail: lcaretto@csun.edu

Mail Code
8348

Phone: 818.677.6448
Fax: 818.677.7062

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
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) = x 2. 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.
L

a0

2
nx
f ( x) cos
dx

L0
L
L

1
f ( x)dx
L 0

an

Fourier Series for f(x) = 3x 2


3
2.75
2.5
2.25

f(x)=3x^2

f(x) = 3x2

1 term

1.75
1.5

2 term s

1.25

3 term s

5 term s

0.75

10 term s

0.5
0.25
0
- 0.25
-1

- 0.75

- 0.5

- 0.25

0.25

0.5

0.75

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

1
1 x3
a 0 x 2 dx

L0
L 3
L

1 L3
L2
0

L 3
3

L
2
2 Lx 2
L2 2 x
2 L3
nx
nx
nx
nx
a n x 2 cos
sin
cos

sin
dx


2
3
L0
L n
L
L n
L n
L

2 L3
2 L3
2 L3
2 L(0) 2
L2 2(0)

sin
n

cos
n

sin
n

sin
0

cos 0

L n
L n
n 2
n 3
n 2

2 L3
2 L3
2 L3
2 L3
4 L2

sin
0

sin
n

cos
n

sin
n

cos n

L n
n 3
n 2
n 3
n 2

Jacaranda (Engineering) 3333


E-mail: lcaretto@csun.edu

Mail Code
8348

Phone: 818.677.6448
Fax: 818.677.7062

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.

an

4 L2 (1) n
n 2

x2

L2 4 L2

3 2

(1) n
nx
cos

2
L
n 1 n

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

2
nx
bn f ( x) sin
dx
L0
L
L

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

bn

L
2 2
2 Lx 2
L2 2 x
2 L3
nx
nx
nx
nx
x
sin
dx

cos

sin

cos

2
3

L0
L n
L
L n
L n
L

2 L
2L
2L
2 L ( 0)
L 2( 0)
cos n
sin n
cos n
cos 0
sin 0

2
3
L n
L
n
n
n
n 2

2 L3
2 L3
2 L3
2 L3
2 L3

cos

cos

sin

cos

cos 0

3
2
3
3
L n
n
n
n
n

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.

bn

(1) n 2 L2

2 n n4L
2

x2

2 L2
3

(1) n 2 n 2 2 2 nx
sin

n3
L
n 1

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

x2

x2

2 L2
3

L2 4 L2
2
3

(1) n
nx
cos

2
n
L
n 1

(1) n 2 n 2 2 2 nx
sin

n3
L
n 1

1 4(1) n

3
2

2
3

( 1) n
cos n

n2
n 1

(1) n 2 n 2 2 2
sin n
n3
n 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.

Jacaranda (Engineering) 3333


E-mail: lcaretto@csun.edu

Mail Code
8348

Phone: 818.677.6448
Fax: 818.677.7062

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.

cn

1
2

f ( x)e inx dx

f ( x)

c e

inx

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

1
cn
2

2
2in

inx

1 x 2 inx
dx
e

2 in

x inx
e
in

1 1
1 inx
e
in in in

in e

inx

2x

in e

inx

1 2 in ( ) 2 in
dx

e
2
in
in

in
in
1
dx
e

e
2
in
2
in
in

in ( ) in

e
in e
in

1
1
1
1


2
e in
2
3
i n
in 3
2in n
2in n

e in

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.

1
1
1
1
2( 1) n

n
cn ( 1)
2
( 1)
2

in 3
in 3
n2
2in n
2in n
n

Jacaranda (Engineering) 3333


E-mail: lcaretto@csun.edu

Mail Code
8348

Phone: 818.677.6448
Fax: 818.677.7062

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

( 1) n e inx
n2
n

f ( x) x 2 2

Appendix Integrals required for Problem 1


n
We find the following integral, x cos( ax) dx 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
( udv uv vdu ) gives the following result.

n
x cos(ax)dx

x n sin( ax )
nx n 1 sin( ax)

dx
a
a

We can use a similar process of integration by parts to evaluate the integral with the sine term.
This gives the following result.
n
x sin(ax)dx

x n cos(ax)
nx n1 cos(ax)

dx
a
a

Combining these two results gives the following expression for

cos( ax ) dx .

x n sin(ax)
nx n1 sin(ax)
x n sin(ax) n n1

dx
x sin( ax)dx
a
a
a
a
x n sin( ax) n x n1 cos(ax)
(n 1) x n2 cos( ax)

dx
a
a
a
a

n
n 1
x sin( ax) nx cos( ax) n(n 1) n2
n

x cos(ax)dx
x cos(ax)dx a
a2
a2

The final result above can usually be found in an integral table. If we have a definite integral with
n
symmetric limits about x = 0 the integral of x cos( ax ) dx 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.
b

2m

x 2 m sin( ax ) 2mx 2 m 1 cos(ax)


cos( ax)dx

a
a2

2m(2m 1)
x 2 m 2 cos( ax )dx
2

a
b

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.

x 2 m sin( ax ) 2mx 2 m 1 cos( ax )

a
a2

2 m b

2 m 1

a2

cos( ab)

2b

Jacaranda (Engineering) 3333


E-mail: lcaretto@csun.edu

2m

b 2 m sin( ab) 2mb 2 m 1 cos(ab) b

a
a2

2m

sin( ab)
a

sin( ab) 4mb 2 m 1 cos( ab)

a
a2
Mail Code
8348

Phone: 818.677.6448
Fax: 818.677.7062

This gives the following result.


b

2b 2 m sin( ab) 2mb 2 m 1 cos(ab) 2m( 2m 1)


cos(ax )dx

x 2 m 2 cos( ax) dx
2
2

a
a
a
b
b

2m

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

2m

x
cos
dx . This is
2

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

2m

x
cos
dx
2



2m cos

1
2
2 2m( 2m 1) x 2 m 2 cos x dx

2
2

2


1

2
2
2

2 sin

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

4 8m(2m 1)
x
x
2m
2 m2
1 x cos 2 dx 2 1 x cos 2 dx
1

x
dx can be evaluated as follows.
2

The simple integral

cos

2
x
x
1cos 2 dx sin 2
1

4


sin 2 sin 2

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

general formula for

2m

x
cos
dx .
2

4 8( 2 1)
4
8 4
4
x
x
2
1 x cos 2 dx 2 1cos 2 dx 2 3 8
1

4 8(2)[2(2) 1] 2
4 48 4
4
x
x
2
4
2
x cos
dx 2 3 8 5 48 384
2
1 x cos 2 dx

2
1
1

4 8(3)[2(3) 1]
4 120 4
x
x
4
2
x 4 cos
dx 2 5 48 384
1 x cos 2 dx
2

2
1
1

4
x
6
4
2
cos
dx 7 120 5760 46080

Jacaranda (Engineering) 3333


E-mail: lcaretto@csun.edu

Mail Code
8348

Phone: 818.677.6448
Fax: 818.677.7062

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
b

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

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 x
EDU>> 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
Jacaranda (Engineering) 3333
E-mail: lcaretto@csun.edu

Mail Code
8348

Phone: 818.677.6448
Fax: 818.677.7062

EDU>> double(ans)
ans =
5.459022242030317e-002

Jacaranda (Engineering) 3333


E-mail: lcaretto@csun.edu

Mail Code
8348

Phone: 818.677.6448
Fax: 818.677.7062

You might also like