You are on page 1of 46

CA3122

Engineering Analysis

Dr He Xiaoqiao

Department of Civil and Architectural


Engineering
Tel: 3442 4760
Fax: 2788 7612

E-mail: bcxqhe@cityu.edu.hk
Room: AC1 B6401
CA3122 Engineering Analysis ➢1
Course Contents

§ 1.1 Fourier Series Expansion


§ 1.2 Partial Sums and Fourier Series
§ 1.3 Half-range Fourier Series
§ 2.1 Application of Fourier Series in Solving Partial
differential equations: Separation of variables
§ 2.2 Application of Fourier Series in Solving Partial
differential equations: Wave Equation
§ 2.3 Application of Fourier Series in Solving Partial
differential equations: Heat Equation

CA3122 Engineering Analysis ➢2


Course Contents

§3.1 Introduction to Operations Research (OR)


- Linear programming
§3.2 Graphical method in linear programming
§ 3.3 Simplex method in linear programming
§4 Dual Simplex method and dual problem in
linear programming
§ 5.1 Introduction to Transportation Problem
§ 5.2 The method of multipliers for the transportation

problem

CA3122 Engineering Analysis ➢3


Reference
 Frederiick S. Hillier, Gerald J. Lieberman
 Introduction to Operations Research (Ninth Edition)
 McGraw Hill. 2010

 Erwin Kreyszig
 Advanced Engineering Mathematics (7th edition)
 John Wiley & Sons, Inc. 1993

 C.Ray Wylie, Louis C. Barrett


 Advanced Engineering Mathematics. (6th edition). McGraw-Hill, Inc.
1995.

 Michael D. Greenberg
 Advanced Engineering Mathematics. (2th edition). Prentice-Hall
International, Inc. New Jersey. 1998.

 R.N. Bracewell
 The Fourier transform and its applications. (3rd edition).
 Boston: McGraw Hill. 2000.

 Hamdya Taha
 Operations Research An Introduction. (6th edition).
 Prentice-Hall, Inc. 1997.
CA3122 Engineering Analysis ➢4
Grading Policy

Your final grade is based on

• Continuous Assessment : 50%


• End of Semester Exam : 50%

Try your (very ) best to

• Attend all classes; and


• Do all assignments, please.

CA3122 Engineering Analysis ➢5


Contents of this lecture

 Odd and even functions - revision

 Periodic functions - revision

 Fourier series

 Evaluating Fourier coefficients

 Easy ways of finding Fourier coefficients

CA3122 Engineering Analysis ➢6


Fourier Series
What is a Fourier Series?

A Fourier series consists of a sum of sines and cosine terms.


f x   a0   an cos nx  bn sin nx 
n 1

 a0  a1 cos x  b1 sin x  a2 cos 2 x  b2 sin 2 x  

Why do we need to study Fourier Series?

CA3122 Engineering Analysis ➢7


Fourier Series

Why do we need to study Fourier Series?

d2y dy (difficult to obtain its solution)


a 2  b  cy  x sin 2 x
dx dx

d2y dy (easy to obtain its solution)


a 2  b  cy  p sin x
dx dx

x sin x  a0    an cos nx  bn sin nx 
2 Fourier Series
n 1

 a0  a1 cos x  b1 sin x  a2 cos 2 x  b2 sin 2 x 

CA3122 Engineering Analysis ➢8


Summary

d2y dy
a 2  b  cy  f  x 
dx dx

A method to find y p  x  is to make a guess


(a) f x  is a constant k Trail solution : y  c

(b) f x  is a polynomial Trial solution : polynomial form

(c) f x   p sin kx  q cos kx Trial solution : y   sin kx   cos kx

(d) f x   p sinh kx  q cosh kx Trial solution : y   sinh kx   cosh kx

(e) f x   pex Trial solution : y  Aex

CA3122 Engineering Analysis ➢9


Odd and even functions

 Even functions are defined by the property: f ( x)  f ( x)

 Odd functions are defined by the property: f (  x)   f ( x)

y  cos(x) y x

 Even functions
(symmetric to x axis)

yx
y  sin(x)

 Odd functions
(antisymmetric to x axis)
CA3122 Engineering Analysis ➢ 10
Odd and even functions

If f (x) is even:
b
 f(x)
 f ( x )dx
a
a a

 f ( x)dx  2 f ( x)dx
a 0
a b x

a a

 f ( x)dx
a
 f ( x)dx
0

-a a

CA3122 Engineering Analysis ➢ 11


Odd and even functions

 If f (x) is odd:
a 0 a

 f ( x)dx   f ( x)dx   f ( x)dx  0


a a 0

a
 f ( x)dx
0

 f ( x)dx 0
a
 f ( x)dx
a
-a a

CA3122 Engineering Analysis ➢ 12


Odd and even functions

Odd and even functions - revision

 If f (x) is even and g(x) is odd


then:
 h(x) = f (x) x f (x) is even
(even x even = even)
 h(x) = g(x) x g(x) is even
(odd x odd = even)
 h(x) = f (x) x g(x) is odd
(even x odd = odd)

CA3122 Engineering Analysis ➢ 13


Odd and even functions

Any function can be written as the


sum of an even and an odd function
E(-x) = E(x)
E ( x)  [ f ( x)  f ( x)] / 2

O( x)  [ f ( x)  f ( x)] / 2
O(-x) = -O(x)

f ( x)  E ( x)  O( x)

CA3122 Engineering Analysis ➢ 14


Periodic functions
 A periodic function has a basic shape which is repeated
over and over again.
 The fundamental range is the time (or sometimes distance)
over which the basic shape is defined.
 The length of the fundamental range is called the period.
Periodic function: f(x+p) = f(x) for all x; period=p

f(x + np) = f(x) for all x (n: integer)


h(x) = af(x) + bg(x) (f & g are periodic functions with period p; a & b:
constants)
 h(x) is a periodic function with period p.
f ( x)


Fundamental
range

x
0 2 4

CA3122 Engineering Analysis ➢ 15


Periodic functions

Example: Sketch the following function:

1 1  x  0
f x    and f x  2   f x 
2 0  x 1

We can express a general


periodic function as: fundamental range

T T
f ( x)   x 
2 2
f ( x  T )  f ( x)

period = 2
where T is the period.

CA3122 Engineering Analysis ➢ 16


Fourier Series
Assume that f(x) is a periodic function of period 2
that can be represented by a trigonometric series
which is known as Fourier series.

f x   a0   an cos nx  bn sin nx 
n 1

 a0  a1 cos x  b1 sin x  a2 cos 2 x  b2 sin 2 x  

 A Fourier series is a convenient representation


of a periodic function.
 A Fourier series consists of a sum of sines and
cosine terms.
 The coefficients are determined from f(x) by
certain formulas.
CA3122 Engineering Analysis ➢ 17
Fourier Series

(1) Determination of the coefficient term


   

 f x dx   a0   an cos nx  bn sin nx  dx
 
 n 1 
 
 

  a0 dx    an  cos nxdx  bn  sin nxdx   2a0
n 1  
  


  f x dx
1
 a0 
2 

sin x sin y 
1
 cosx  y   cosx  y 
2
cos x cos y  cos  x  y   cos  x  y 
1
Note that 2
sin x cos y  sin  x  y   sin  x  y 
1
2
CA3122 Engineering Analysis ➢ 18
Fourier Series
Orthogonality of the Trigonometric System

sin x sin y 
1
 cosx  y   cosx  y 
Trigonometric system is 2
orthogonal on the interval cos x cos y  cos  x  y   cos  x  y 
1
-  x   2
sin x cos y  sin  x  y   sin  x  y 
1
2
 0 mn
 cos mx cos nx dx   mn

 0 mn
 sin mx sin nx dx   mn

  cos mx sin nx dx  0

(including m  n)
CA3122 Engineering Analysis ➢ 19
Fourier Series

(2) Determination of the coefficients a n of the cosine terms


 
 

 f  x  cos mxdx    a0    an cos nx  bn sin nx   cos mxdx
 
 n 1 
   1  1  
  a0 cos mxdx    an   cos  n  m  xdx   cos  n  m  xdx  

 n 1  2  2  

  1  1  
   bn   sin  n  m  xdx   sin  n  m  xdx  
 n 1  2  2  
1   am 
  an  cos  n  m  xdx    dx  a  m
2 n 1  2 
nm

1 
 am   f  x  cos mxdx  m  1, 2, 3, ...
 

CA3122 Engineering Analysis ➢ 20


Fourier Series

(3) Determination of the coefficients bn of the cosine terms


  

 f  x  sin mxdx    a0    an cos nx  bn sin nx   sin mxdx
 
 n 1 
   1  1  
  a0 sin mxdx    an   sin  n  m  xdx   sin  n  m  xdx  

 n 1  2  2  

  1  1  
   bn   cos  n  m  xdx   cos  n  m  xdx  
 n 1  2  2  
1   b 
  bn  cos  n  m  xdx  m   dx  b  m
2 n 1  2 
nm

1 
 bm   f  x  sin mxdx  m  1, 2,3,...
 

CA3122 Engineering Analysis ➢ 21


Fourier Series

Summary of These Calculations:


  f x dx
1
Fourier Coefficients: a0 
2 


f  x  cos nxdx n  1, 2 ,3,...
1
an 
  


f  x sin nxdx n  1, 2 ,3,...
1
bn 
   


Fourier Series: f  x   a0   an cos nx  bn sin nx 
n 1

CA3122 Engineering Analysis ➢ 22


Fourier Series
Example: Find the Fourier series for: f(x)
k
 k (  x  0)
f x    and f x  2   f x 
k (0  x   ) -  x

-k

  f x dx  0
1
a0 
2 

 
f  x  cos nxdx     k  cos nxdx   k  cos nxdx   0
1 1 0
an 
      0 
 
f  x sin nxdx     k sin nxdx   k sin nxdx  
1 0
bn 
1

2k
1  cos n 
    0  n
4k 4k 4k
b1  , b2  0, b3  , b4  0, b5 
, ...
 3 5

4k  1 1 
 f  x   a0  an cos nx  bn sin nx    sin x  sin 3x  sin 5 x  ...

n 1
  3 5 
CA3122 Engineering Analysis ➢ 23
Fourier Series
Functions of f(x) with any period p = T
2 Tv  T T
v x    v     x     x  
T 2  2 2
 
 2n 2n 
g  v   a0    an cos nv  bn sin nv  f  x   a0    an cos x  bn sin x
n 1 n 1  T T 
T
 1

1
a0    g  v  dv a0  2
T f ( x) dx,
2  T 
2

1  2 T2  2nx 
an   g  v  cos nvdv an   T f ( x) cos  dx
   
T 2  T 

1  2 T2  2nx 
bn   g  v  sin nvdv bn   T f ( x) sin   dx
  
T 2  T 
CA3122 Engineering Analysis ➢ 24
Fourier Series

Example: Find the coefficients for the


Fourier series of:
 x    x  0
f ( x)   and f ( x  2 )  f ( x)
 x 0 x 

f ( x)


Fundamental
range

x
0 2 4
Period = 2π

CA3122 Engineering Analysis ➢ 25


Fourier Series

 Find a0
T
2 
1 1
a0 
T T f ( x)dx  a0  2  f ( x)dx


2

 f (x) is an even function so:


 
1 1
a0 
2  f ( x)dx

 a0 
  f ( x)dx
0

 
1 1 x   2
 a0   xdx  a0     a0 
 0   2 0 2

CA3122 Engineering Analysis ➢ 26


Fourier Series

 Find a n
T

2
 2nx   2nx 
1
an 
2
T f ( x) cos T dx  an   f ( x) cos dx
T    2 

2

 Since both functions are even their


product is even:

 
x cos nx dx
2
 f ( x) cosnxdx
1
an 

 an 
 
 0

CA3122 Engineering Analysis ➢ 27


Fourier Series

 Now we will have to use integration by parts.


b b
du
a u dxdx  uva  a v dx dx,
dv du
b
u  x  1
dx
sin nx 
 cos nx   v 
dv
dx n
 Substituting:
2   x sin nx  sin nx  
  
an   x cos nx dx  an 
2
   dx
 0 
   n 0 0 n 

2   cos nx   2  cos n   1 

 an  0   a   

   n 0 2  n
  n 2

2
n

 an  2  1  1
n

CA3122 Engineering Analysis ➢ 28
Fourier Series

 Find bn
T

2 2
 2nx  1  2nx 
bn 
T T f ( x ) sin 
 T


dx  bn 
  f ( x ) sin 
 2 
dx

2

 Since sine is an odd function and f (x) is an


even function, the product of the functions
is odd:

 f ( x) sin nxdx
1
bn   bn  0
 

CA3122 Engineering Analysis ➢ 29


Fourier Series

 So we can put the coefficients back


into the Fourier series formula:


  2nx   2nx  
f ( x)  a0    an cos   bn sin   
n 1   T   T 


 

 2 
 f ( x)     2  1  1 cos nx 
n

2 n 1  n 


cos  x   0  cos 3 x   
4 4
 f ( x)  
2  9

CA3122 Engineering Analysis ➢ 30


Fourier Series

Example: f(x)
k
0 if  2  x  1

f  x   k if  1  x  1 and f  x  4   f  x  -1 1 x
 0 if 1 x  2

p  T  4, T 2  2

 nx  n
T
1 1 1 k 1 1 2k
a0 
T 

2
T
2
f ( x) dx   k dx  , an   k cos
4 1 2 2 1  2 
 dx 
n
sin
2
2k 2k 1 1  nx 
 an  (n  1,5,9,...), an   (n  3,7,11,...), bn   k sin   dx  0
n n 2 1
 2 

k 2k   1 3 1 5 
f ( x)    cos x  cos x  cos x  
2   2 3 2 5 2 
CA3122 Engineering Analysis ➢ 31
Fourier Series
 0 if    t  0  2 
Example: u t    and u t    u t 
 E sin t if 0t     
u(t)
2
T     E k
p T  , 
 2 
a0 
2 
0
E sin t dt 
 -/ /
  E  
sin 1  n t  sin 1  n t  dt
 0 2 0
an  E sin  t cos n  t dt 

E  cos 1  n t cos 1  n t  E   cos 1  n   1  cos 1  n   1 


 

an  
2 

11n n

11n n  0
 
2  1 n

1 n


n  1

 2 2 
a1  0, an  0 n  3, 5, ..., an 
E
  
2E
n  2, 4, ...
2 1 n 1 n  n  1n  1
  E  
  cos 1  n  t  cos 1  n  t  dt  b1  E 2 and bn  0 for n  2, 3, ...
 0 2 0 
bn  E sin  t sin n t dt 

E E 2E  1 1 
u t    sin t   cos 2t  cos 4t  ...  .
 2   1 3 35 
CA3122 Engineering Analysis ➢ 32
Easy Ways of Finding Fourier Coefficients

Easy ways of finding Fourier coefficients

 There are some easy shortcuts for finding


the Fourier coefficients.
 We can see that: b

T
f(x)
 f ( x )dx
a
2
1
a0 
T  f ( x)dx
T

2 a b x

is just the area under the fundamental


range divided by the period.

CA3122 Engineering Analysis ➢ 33


Easy Ways of Finding Fourier Coefficients

Example: 1  1  x  0
f ( x)   and f ( x  2)  f ( x)
2 0  x  1
T  2
Using the formula:
T
2 1
1 1
a0 
T T f ( x)dx  a 0  
2 1
f ( x)dx

2

0 1
1 1 1 2 3
 a0   1dx   2dx  a0   
2 1 20 2 2 2

CA3122 Engineering Analysis ➢ 34


Easy Ways of Finding Fourier Coefficients

 Using the area under the


fundamental range:

Period = 2

Fundamental
range

area 1 2 3
 a0   a0   a0 
period 2 2
CA3122 Engineering Analysis ➢ 35
Easy Ways of Finding Fourier Coefficients

 So if the periodic function has a


simple shape we can use
geometry to find the solution.

 We can also use the properties


of even and odd functions to
make finding the Fourier
coefficients easier.

CA3122 Engineering Analysis ➢ 36


Easy Ways of Finding Fourier Coefficients

 Consider the formula for Fourier series:


  2nx   2nx  
f ( x)  a0    an cos 
 n 
b sin  
n 1   T   T 

 Since all the sines are odd functions and all


the cosines are even functions, we can
break the function and the Fourier series
into two parts:

f ( x)  f odd ( x)  f even ( x)

CA3122 Engineering Analysis ➢ 37


Easy Ways of Finding Fourier Coefficients

 We can compare with the Fourier series to get:


  2nx  
f odd ( x)    bn sin   
n 1   T 


 2n x  
f even ( x)  a0    an cos  
n 1   T 
 Thus, if f (x) is odd:
f even ( x)  0  a0  0  a n
 And, if f (x) is even:
f odd ( x)  0  bn  0

CA3122 Engineering Analysis ➢ 38


Easy Ways of Finding Fourier Coefficients

 We can also see these results from our


formulae for the coefficients:
T

 2nx 
2
2
an 
T T f ( x) cos T dx

2

 If f (x) is odd then we are integrating an


odd function (odd x even = odd).
 As we saw earlier, integrating an odd
function over the interval (-a, a) is zero for
any value of a.
 i.e. f (x) is odd  a  0  a 0 n

CA3122 Engineering Analysis ➢ 39


Easy Ways of Finding Fourier Coefficients

 Similarly, for the coefficients:


T

 2nx 
2
2
bn 
T T f ( x) sin  T dx

2

 If f (x) is even then we are integrating an


odd function (even x odd = odd).

 So:
f (x) even  bn  0

CA3122 Engineering Analysis ➢ 40


Easy Ways of Finding Fourier Coefficients

Summary of finding coefficients

function function function


even odd neither
T
T
2
1
 f ( x)dx
2
2
0 a0 
a0 a0 
T  f ( x)dx
0
T

T
2

T T

 2nx   2nx 
2 2
4 2
an
an 
T  f ( x) cos
0
T 
dx
0 an 
T  f ( x) cos
T T 
dx

2

T T

 2nx   2nx 
2 2
4 2
bn 0 bn 
T 
0
f ( x) sin 
 T 
dx bn 
T T f ( x ) sin 
 T 
dx

2

CA3122 Engineering Analysis ➢ 41


Easy Ways of Finding Fourier Coefficients

Example:  Find the Fourier series for:


 1  2  x  1

f ( x)   1  1  x  1 and f ( x  4)  f ( x)
 1 1  x  2

 We can use the area under


the curve to find a0
area 1 2 1
a0   0 Fundamental
range
period 4
 The function is even so:
Period = 4

bn  0
CA3122 Engineering Analysis ➢ 42
Easy Ways of Finding Fourier Coefficients

 All we have to find is:


T

 2nx   nx 
2 2
2 1
an 
T T f ( x ) cos 
 T 
 dx  a n 
2 2
f ( x) cos 
 2 
dx

2

 even function x even function:


 nx 
2
 an   f ( x) cos dx
0  2 

 nx   nx 
1 2
 an   (1) cos  dx   ( 1) cos  dx
0  2  1  2 

CA3122 Engineering Analysis ➢ 43


Easy Ways of Finding Fourier Coefficients

 Evaluate the integrals:


 nx   nx 
1 2
an   (1) cos  dx   ( 1) cos  dx
0  2  1  2 
1 2
 2  nx   2  nx 
 an   sin     sin  
 n  2  0  n  2  1

 n  2  n 
sin 0  sin n  
2 2 2
 an  sin   sin  
n  2  n n n  2 

0 n even
4  n  4 
 an  sin    an    1  ,1, 5, 9 
n  2  n 
 1  , 3, 7,11
CA3122 Engineering Analysis ➢ 44
Easy Ways of Finding Fourier Coefficients

 So the Fourier coefficients for:


 1  2  x  1

f ( x)   1  1  x  1 and f ( x  4)  f ( x)
 1 1  x  2

are: n  even
0
4 
bn  a0  0, an   1 n  1, 5, 9 
n 
 1 n  3, 7,11
Answer!

 3 5 7
f  x   cos x 
4 4 4 4
cos x cos x cos x  ...
 2 3 2 5 2 7 2

CA3122 Engineering Analysis ➢ 45


Assignment 1

e x  1  x  0
3. Find the Fourier series of f x    , f  x   f  x  2 .
 x 0  x 1

Due date: 23 Jan 2018 (before lecture)


CA3122 Engineering Analysis ➢ 46

You might also like