28 June 2016 Metode Numerik II 1

advertisement
28 June 2016
Metode Numerik II
1
Bounary Value & Eigenvalue Probelms
•Linear ODEs
•Nonlinear ODEs*
•Shooting Method*
•Finite Difference Method (FDM)
•Eigenvalue Problems
28 June 2016
Metode Numerik II
2
Types of Boundary Conditions
•Simple B.C (Dirichlet B.C): The value of the unknown
function is given at the boundary.
y (a)  y a
•Neumann B.C.: The derivative of the unknown function
is given at the boundary.
dy
dy (a)


dx x  a
dx
•Mixing B.C.: The combination of the unknown function’s
value and derivative is given at the boundary.
a
28 June 2016
dy ( a )
 b  y (a)  
dx
Metode Numerik II
3
Shooting Method
For a simple (Dirichlet) B.C linear ODE:
y ' '  p( x) y ' q( x) y  r ( x)
y (a)  y a and y(b)  yb
yb  u (b)
If v(b)  0, then y  u ( x) 
v( x).
v(b)
u''  p(x)u'  q(x)u  r(x) u (a)  y a , u ' (a)  0.
v''  p(x)v'  q(x)v
28 June 2016
v(a)  0,
Metode Numerik II
v ' ( a )  1.
4
Principle of Shooting Method
y ''  p ( x) y '  q( x) y  r ( x)
u''  p(x)u'  q(x)u  r(x)
v''  p(x)v'  q(x)v
0
Homogenous Equ.
Solution for v is the general solution for y
Solution for u is the particular solution
y  u  Av
y ( a )  ya
where A is the arbitrary constant
u (a )  Av(a )  y (a )
(1)
y(b)  yb
u (b)  Av(b)  y (b)
Noticing
u ( a )  ya ,
From (2)
y (b)  u (b)
A
v(Metode
b) Numerik II
28 June 2016
from (1)
(2)
v( a)  0,
5
Shooting Method
•Reducing the two 2nd-order I-V ODEs to four 1st-order ODEs.
•Solving the system of ODEs (four 1st-order ODEs) using either
R-K or Multi-step methods.
u1  u, u 2  u'  u1 ' , u3  v, u 4  v'  u3 '.
Four ODEs and their Initial Conditions .
u1 '  u 2 ,
u1 (a)  y a
u 2 '  p( x)u 2  q( x)u1  r ( x)
u 2 (a)  0
u3 '  u 4 ,
u3 (a)  0
u 4 '  p( x)u 4  q( x)u3
u 4 (a)  1.
28 June 2016
Metode Numerik II
6
Finite-Difference Method (FDM)
y' '  p( x) y ' q( x) y  r ( x)
y (a)   and y(b)  
Approximate the derivatives using numerical difference schemes.
h
x0 =a x1
xi-1
xi
xi+1
xn=b
ba
Dividing the range into n equal segments. h  x 
.
n
yi 1  2 yi  yi 1
y ' ' ( xi )  y i ' ' 
 O(h 2 ),
h2
yi 1  yi 1
y ' ( xi )  y i ' 
 O(h 2 )
2h Metode Numerik II
28 June 2016
7
Finite-Difference Method (FDM) (continued)
• Substituting the derivatives by approximations and then
we have a set of discretized equations
At i  1,2,.......n  1
yi 1  2 yi  yi 1
yi 1  yi 1
 pi
 qi yi  ri .
2
2h
h
Multiply both sides by h 2 .
h
h
2
( 1  pi )y i-1 - ( 2  qi h ) yi  (1  pi ) yi 1  h 2 ri
2
2
28 June 2016
Metode Numerik II
8
Finite-Difference Method (FDM) (continued)
For i  1.
h
h
2
- ( 2  q1h ) y1  (1  p1 ) y 2  h r1  (1  p1 )
2
2
For i  2,3,......,n  2,
h
h
2
( 1  pi )y i-1 - ( 2  qi h ) yi  (1  pi ) yi 1  h 2 ri
2
2
For i  n  1,
h
( 1  pi )y n  2 - ( 2  qi h 2 ) y n 1 
2
h
2
h rn 1  (1  p n 1 ) 
2 Metode Numerik II
28 June 2016
2
9
Matrix Form of Equ. System
If h 
a-b
and n  7, noticing that
7
y (a)   and
y (b)   .
h


2
(
2

q
h
)
1

p
0
0
0
0
1
1


2
h 
 2


h
r

(
1

p
h
h
1 ) 
 1  p2
  y1   1
- ( 2  q2 h 2 ) 1  p2
0
0
0
2




2
2
2

 y
h
r
2

 2 
h
h
2


0
1  p3
- ( 2  q3 h ) 1  p3
0
0

h 2 r3

  y3  
2
2


 y   
2
h
h
2
h
r

4
0
0
1  p4
- ( 2  q4 h ) 1  p4
0

 4  
2
2


  y5  
h 2 r5
h
h   


0
0
0
1  p5
- ( 2  q5 h 2 ) 1  p5   y6   2
h 

h r6  (1  p6 )  
2
2 

2 


h
2 
0
0
0
0
1  p6
- ( 2  q6 h )

2


What kind of matrix is it ?
28 June 2016
Metode Numerik II
10
d 2T
dx 2
d 2T
dx 2
 h '(Ta  T )  0, T (0)  40, T (10)  200, Ta  20, h '  0.01m-2 .

Ti 1  2Ti  Ti 1
x 2
;
Ti 1  2Ti  Ti 1
x 2
 h '(Ta  Ti )  0;
Ti 1  (2  h ' x 2 )Ti  Ti 1  h ' x 2Ta
n  5, x  2m.
For i  1,  T2  2.04T1  T0  0.8  T2  2.04T1  40.8,
For i  2,  T3  2.04T2  T1  0.8,
For i  3,  T4  2.04T3  T2  0.8,
For i  4,  T5  2.04T4  T3  0.8  2.04T4  T3  200.8
28 June 2016
x0
x1
x
Metode Numerik II
x2
x3
x4
x5
11
Eigenvalue Problems
Eigen-value problems are a special class of B-V problems.
 A x    x
 is unknown parameters which are eigenvalues.
For given  A , there are usually many eigenvalues.
 xi is known as eigenvector.
 A x    I  x  0
For each λi , the solution
 A x    x
 A   I  x  0
A homogenous equation system.
For28non-trivial
solution Metode
of Numerik
 x , II det  A   I   0 .
June 2016
12
Matrix Formation
 a11
a
A   21
 a31

a 41
a12
a 22
a32
a 42
a11  
 a
A  I    21
 a31

 a 41
a13
a 23
a33
a 43
a14 
a 24 
a34 

a 44 
a12
a 22  
a32
a 42
a13
a 23
a33  
a 43
a14 
a 24 
a34 

a 44   
det A  I   0, leads to a fourth order equation of .
28 June 2016
Metode Numerik II
13
Physics of Eigenvalues & Eigenvectors
A system of two degrees of freedom.
x1
To simplify the problem,
we assume that
k1= k2= k3= k.
m1
d 2 x1
dt
2
x2
k2
k1
m1
  kx1  k ( x 2  x1 )
m2
k1x1
2
d x2
m2
 kx2  k ( x 2  x1 )
2
dt
28 June 2016
Metode Numerik II
k3
k2(x2-x1)
k2(x2-x1)
m1
m2
k3x2
14
Physics of Eigenvalues (continued)
Both masses (m1& m2) are oscillating w.r.t. their mean positions.
xi  Ai sin (t )
d 2 xi
dt
2
i  1 or 2.
  2 Ai sin (t)
i  1 or 2.
Substituting the above equ.s Into the motion equ.s and
dividing both sides by sin (t ) .
  2 m1 A1  kA1  k ( A2  A1 )
  2 m2 A2  kA2  k ( A2  A1 )
28 June 2016
 2k
 m
 1
 k
 m2
Metode Numerik II
k 
m1   A1 
2  A1 

  
2k   A2 
 A2 

m2 

15
Physics of Eigenvalues (continued)
 2k
 m
 1
 k
 m2
k 

m1   A1 
2  A1 
     
2k   A2 
 A2 

m2 
Cx  x
Hence, the eigenvalues are related to the natural frequencies
or periods which are crucial to the design of structures.
The eigenvectors are related to the motion of a structure
related to the corresponding natural frequency.
For most engineering problems, the largest or the smallest
frequencies are the most important ones to know.
28 June 2016
Metode Numerik II
16
Steps of Solving Eigen-value Problems
•
detA  I   0 . leads to an algebraic equation of  .
•Solving the equation for  .
- Polynomial method (find roots of an equation) (p765-767).
- Other methods (more efficient): Power Method.
•Given the eigenvalues
eigenvectors x .
28 June 2016

, obtain the corresponding
Metode Numerik II
17
Power Method
The Power Method is an iterative procedure for determining
the dominant (largest) eigenvalue of the matrix A and the
corresponding eigenvector.
Ex27.7 p767 Power Method for the dominant (highest)
eigenvalue and its eigenvector.
1.778
0   x1 
 3.556
 x1 
 1.778 3.556  1.778  x     x 
 2

 2 

x 
 0
 1.778 3.556  
 x3 
 3
1. Guess a solution
28 June 2016
for the eigenvecto r , x1  1, x2  1, x3  1.
Metode Numerik II
18
Example of Power Method (Continued)
substituti ng the eigenvecto r into the left - hand - side of Eq.
0  1 1.778
 3.556  1.778
 1.778 3.556  1.778 1   0 


  
 0
 1.778 3.556  1 1.778
2. Normalize the approximat e eigenvecto r (the right - hand - side), so
that the element of the largest absolute value becomes either 1 or - 1.
1.778
1


 
0

1
.
778


0
1.778
1


 
3.Using the current normalized eigenvecto r xT  1 0 1 as the guess
and repeat steps 1 and 2.
28 June 2016
Metode Numerik II
19
Example of Power Method (Continued)
substituti ng the eigenvecto r into the left - hand - side of Eq.
0  1  3.556 
 3.556  1.778
1
 1.778 3.556  1.778 0   3.556  3.556 1

 

  
1
 0
 1.778 3.556  1  3.556 
 
4. Examine the relative error of  ,
εa 
i  1  i
3.556  1.778

 50%.
i  1
3.556
if ε a is greater than the tolerance error, the iteration continues.
Otherwise, the eigenvalue  , and the eigenvecto r x are obtained.
.............................
The fifth iteration renders 4  6.223,
x1 2016

x 2 x3    0.714 1 Metode
 0.714
28 June
Numerik II
20
Example of Power Method (Continued)
0   0.714  4.317 
 3.556  1.778
 0.708
 1.778 3.556  1.778  1    6.095   6.095 1 
 





 

 0.708
 0
 1.778 3.556  
 0.714  4.317 


6.095  6.223
a 
 2.1%  1%
6.095
The sixth iteration
0   0.708  4.296
 3.556  1.778
 0.707 
 1.778 3.556  1.778  1    6.074   6.074 1 
 





 

 0.707 
 0
 1.778 3.556  
 0.708  4.296


6.074  6.095
a 
 0.35%  1%
6.074
  6.074
28 June 2016
and
 x1   0.707 
  

x

1
 2 
 are obtained.
 x   0.707 
 3 

Metode Numerik II
21
Inverse Power Method
The Power Method can be modified to provide the smallest
(lowest) (magnitude) eigenvalue and its eigenvector. The
modified method is known as the inverse power method.
The inverse power method is to modify the original equ.
 A x    x .
Left Multiplication of
1
 A  A x   A   x ,
1
Noticing that  A  A   I  ,
The equation becomes
where
-1
to the equ.
-1
1
 B    A
,
 x    A
-1
1
 x .
 x   A  x .
 B  x    x
Dividing both sides by  ,
28 June 2016
 A

   .
Metode Numerik-1
II
-1
22
Ada Pertanyaan
???
28 June 2016
Metode Numerik II
23
Download