Solution

advertisement
6.11.2003
EE 443
COMPUTATIONAL METHODS IN ELECTRICAL ENGINEERING
Midterm Exam I
SURNAME
NAME
STUDENT ID
SIGNATURE
:
:
:
:
QUESTION
GRADE
1
2
3
4
5
6
7
8
9
TOTAL
Useful Formulae :
 The Jacobian of a vector function f x   f1 x
vector variable x  x1
 f1 x 
 x
1



f
x
2

J   x1


 f n x 
 x1
x2  xn  is given by
T
f1 x 
x2
f 2 x 
x2
f n x 
x2
f1 x  
x n 

f 2 x  
x n 


f n x  
x n 
f 2 x  f n x of the
T
1) (15 pts.) Consider the polynomial x 3  3x 2  3x  1 which can be written in three
different forms as
i)
ii)
p x   x 3  3x 2  3 x  1
qx  x  3x  3x 1
iii) r x   x  1
3
Assume that we want to evaluate this polynomial at x  2 by using fixed point
arithmetic. The number x has a representation x̂ in this fixed point system, thus
x
the absolute and relative errors in x are x  x  xˆ and x 
, respectively.
x
Determine the absolute and relative errors in evaluating the polynomial at x  2
by using the three forms in terms of x . Assume that the coefficients have exact
represantations in the fixed point arithmetic.
Solution
x 
x
x
, x  x x, x 
x
2
i)
x 3  3x x 3  3 x x  24x
3
 
x 2  2x  3 x 2  2 3 x 2 x  24x
3 x  x 3 x   3 x x  6x
 
p  x 3   3 x 2  3 x   54x  27 x
p 
p 27 x

 27 x
p
1
ii)
x  3  x 3  x  
x  3
 x
x 3
x  3x   x  3  x  x 
x  3x   x  3x
x 3x

2
2
3x
 3x
2
x  3x  3  3x x  3x  3 
3x
 3x
x  3x  3
1
7x
 x  3x  3x   3x  x  3x  x 
2
2
7 x
q 7x
q 
q 

2
q
2
iii)
 x  1  x  x  1 


x
 x
x 1
  x  1  3 x  1  3x
3
r  3x r  3x
2) (10 pts.) Given the recursive formula
yn  3 yn1  4 yn2
with initial values y 0  1 and y1  4 . Calculate the maximum number n for
which y n can be calculated with double precision arithmetic using IEEE-754
standard.
Solution
y 2  3 y1  4 y 0  3  4  4 1  4 2
y3  3 y 2  4 y1  3  4 2  4  4  4  4 2  4 3

yn  4 n
(assume! )
y n 1  3 y n  4 y n 1  3  4 n  4  4 n 1  4  4 n  4 n 1
(proof by induction! )
IEEE-754 double precision standard uses 64 bits with 11 bits reserved for the
exponent in excess 1023 format. In addition ‘7FF’H in exponent is reserved to
denote ‘inf’. Thus the exponent can at most be ‘7FE’H corresponding to
211  2  1023  1023 . The mantissa can at most be about 1.9999... and a number
slightly greater than 21023 can be represented but 21024 is ‘inf’.
21024  4 512  inf
Hence y512 is ‘inf’ but y511  4 511  21022 can be calculated.
3) (15 pts.) Decompose the following matrix A into LU form
 5
 4
A
 1

 2
4
2
2
1
1
0
4
2
1
 4
1

 1
Solution
4 1
1
4
1
1
 5
5



d12  0.8  4  2
0  4  e . r .o .
0
1.2  0.8  3.2

A


d13  0.2   1  2  4
d 23  1 0  1.2  4.2
1
1.2




d14  0.4  2
d 24  0.5 0  0.6
1
2  1
2.4  1.4
4
1
1
4
1
1
5
5
0 1.2  0.8  3.2
0 1.2  0.8  3.2
e . r .o .
e . r .o .

 




0
0
0
5
 2
0
5
 2




d 34  0.4 0
0
2
 3
0
0  3.8
0
Hence
1
0
0

  0.8
1
0
L
 0.2
1
1

 0.4  0.5  0.4
0
0
0

1
4
1
1
5
0 1.2  0.8  3.2

U
0
0
5
 2


0
0  3.8
0
or in compact form
4
1
1
 5
  0.8
1.2  0.8  3.2

LU 
 0.2
1
5
 2


 0.4  0.5  0.4  3.8
4) (15 pts.) Use Gauss-Seidel iterations to determine a solution of the following
system of non-linear equations.
x2  y  4  0
y2  x  5  0
Use x0  1 and y 0  1 as a starting point and carry out the calculations until your
final estimate is correct to 3 decimal places.
Solution
x0  y 0  1
From the first equation
x12  1  4  0  x1  3  1.732
From the second equation
y12  1.732  5  0  y1  5  1.732  1.808
Going on in this way we get
x 22  1.808  4  0  x 2  4  1.808  1.481
y 22  1.481  5  0  y 2  5  1.481  1.876
x32  1.876  4  0  x3  4  1.876  1.457
y32  1.457  5  0  y3  5  1.457  1.882
x 42  1.882  4  0  x3  4  1.882  1.455
y 42  1.455  5  0  y3  5  1.455  1.882
We see that x4  x3 and y 4  y3 in three decimal places hence we can stop iterating.
Solution:
x  1.455
y  1.882
5) (15 pts.) Use Newton’s method to determine a solution of the following system of
non-linear equations.
x2  y  4  0
y2  x  4  0
Use x0  1 and y 0  1 as a starting point and carry out the calculations for 2 steps.
Solution
 x 2  y  4
2 x 1 
1


J  x, y   
f
x
,
y

 2
 s0   

 1 2 y
1
 y  x  4
2 1 
  2
1  2  1
J0  
J 01  
f0   


3   1 2
1 2 
  2
1 1  2  1  2 5 / 3
s1  s 0  J 01f 0     
    
1 3  1 2  2 5 / 3
1 
 1
10 / 3
 4 / 9
9 10 / 3
J1  
J 11  
f1  



10 / 3
91   1 10 / 3
 1
 4 / 9
 1 4 / 9 61 / 39 1.5641
5 / 3 9 10 / 3
s 2  s1  J 11f1     




5 / 3 91   1 10 / 3 4 / 9 61 / 39 1.5641
6) (10 pts.) The Conjugate Gradient Method can only be applied to systems of
linear equations with positive determinate coefficient matrix, i.e., for systems
Ax  b
where A is a positive determinate matrix. For non-symmetric and/or indefinite
systems, one approach is to apply the Conjugate Gradient Method to
A T Ax  A T b
where A T denotes the transpose of the matrix A. Prove that AT A is a
symmetric, positive definite matrix.
Solution
A A  A A   A A  Hence A A is symmetric
x A A x  x A Ax   xA Ax   Ax  0 x 
T
T
T
T T
T
T
T
T
T
T
T
AT A is non-negative
definite.
Ax  b
multiply both sides by A T
A T Ax  A T b
equation.
hence the solutions will include the solutions of the original
7) (10 pts.) Find the dominant eigenvalue,  d , and a corresponding eigenvector, e d ,
of the matrix
  1 11 40
A   2 12 40
 1  1 0
using the power method.
Solution
1
Take x 0  1

1
  1 11 40 1 50
y 0   2 12 40 1  50
 1  1 0 1  0
x1  y 0 / y 0

 50   d ,1
y1

 10   d , 2
 1 1 0
T

  1 11 40 1 10
y 1   2 12 40 1  10
 1  1 0 0  0
x 2  y1 / y1
y0
 1 1 0  x1
T

Hence  d  10, e d  1 1 0
T
8) (10 pts.) Discuss whether the following matrices are positive definite or not:
2
7
3
25
 2 11  4  3

A
 7  4 16  1


 3  3  1 17 
 7  1  2  3
  1  11
1
2
B
 2
1
6
2


2
2 15
 3
 18 2
 2 6
C
 3 1

 8 0
8
1 0
6  1

2 15
3
Determine also the  1 and   norms of these matrices.
Solution
 A is symmetric;
for row 1 : 25>2+7+3=12
for row 2 : 11>2+4+3=9
for row 3 : 16>7+4+1=12
for row 4 : 17>3+3+1=7
Hence A is diagonally dominant and all diagonal entries are positive, hence A
is positive definite.
 B is symmetric but one diagonal element is negative. In fact Gerschgorin
circle theorem shows that B has a negative eigenvalue (row 2) and 3 positive
eigenvalues (other rows). Hence B is indefinite.
 C is not symmetric, however Gerschgorin circle theorem shows that all
eigenvalues are positive, hence C is positive definite.
2
7
3
25
 2 11  4  3


A   7  4 16  1


 3  3  1 17 
37 20 28 24
2
7
3
25


20
 2 11  4  3
28 B   7  4 16  1


24
 3  3  1 17 
13 15 11 22
37
13
15
11
22
A1 A
B1 B
2
7
3 31
25
 2 11  4  3 9


C   7  4 16  1 11


 3  3  1 17  25
31
9 12 24


 37
 22
C 1  C   31
Download