



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




A =
Solution: The inverse of A is given by:
1 4 0 0 0 − 16 0 (^0 0 )
The norm of A and A−^1 : ||A|| = 6
∣∣∣∣ A−^1
∣∣∣∣ = (^12) And the condition number is given by:
cond (A) = ||A|| ·
∣∣ ∣
∣∣ ∣A−^1
∣∣ ∣
∣∣ ∣ = 6 ×
(a) Aa =
[ 1010 0 0 10 −^10
] , the inverse is given by A−a 1 =
[ 10 −^10 0 1010
] .
The norms of Aa and A−a 1 are: ||Aa|| = 10^10
∣∣∣∣ A−a^1
∣∣∣∣ = 10^10 And the condition number is given by:
cond (Aa) = ||Aa|| ·
∣∣ ∣
∣∣ ∣A−a^1
∣∣ ∣
∣∣ ∣ = 10^20
Because cond (Aa) >> 1 the matrix is close to singularity, and therefore, Aa is ill-conditioned.
(b) Ab =
[ 1010 0 0 1010
] , the inverse is given by A−b 1 =
[ 10 −^10 0 10 −^10
] .
The norms of Ab and A−b 1 are:
||Ab|| = 10^10
∣∣ ∣
∣∣ ∣A−b^1
∣∣ ∣
∣∣ ∣ = 10−^10 And the condition number is given by: cond (Ab) = ||Ab|| ·
∣∣ ∣
∣∣ ∣A−b^1
∣∣ ∣
∣∣ ∣ = 1
Because cond (Ab) = 1 the matrix is far from singularity, and therefore, Ab is well- conditioned. (c) Ac =
[ 10 −^10 0 10 −^10
] , the inverse is given by A−c 1 =
[ 1010 0 0 1010
] .
The norms of Ac and A−c 1 are: ||Ac|| = 10−^10
∣∣ ∣
∣∣ ∣A−b^1
∣∣ ∣
∣∣ ∣ = 10^10 And the condition number is given by: cond (Ac) = ||Ac|| ·
∣∣ ∣
∣∣ ∣A−c^1
∣∣ ∣
∣∣ ∣ = 1
Because cond (Ac) = 1 the matrix is far from singularity, and therefore, Ac is well- conditioned. (d) Ad =
[ 1 2 2 4
] , because |Ad| = 0 → A−d 1 does not exist, the condition number is inf and therefore the matrix is ill-conditioned.
Part 1: mat files listing
The following m-file constructs a Hilbert matrix, computes B = A^2 and computes the condition number for matrices A and B using the infinity norm:
0001 %% MATH 4800 - HOMEWORK 1 0002 % This m-file performs the required steps in problem 3, is latter 0003 % changed into a function for multiple evaluation. 0004 % ------------------------------------------------------------------- 0005 n = input(’Enter the dimension "n" of the Hilbert matrix: ’) 0006 % Construct the Hilbert Matrix A 0007 A = []; 0008 for i = 1:n 0009 for j = 1:n 0010 A(i,j) = 1/(i+j-1); 0011 end 0012 end 0013 % Obtain Aˆ 0014 B = Aˆ 0015 % Obtain the condition numbers using the norm function 0016 Co_A = norm(A,inf)norm(inv(A),inf) 0017 Co_B = norm(B,inf)norm(inv(B),inf)
0028 dppA = [dppA dpA]; dppB = [dppB dpB]; 0029 end 0030 %% Display Results 0031 %% Linear Plot 0032 figure(2); set(gcf,’color’,’white’); 0033 plot(nn,Co_A,’b-’,nn,Co_B,’r--’,’LineWidth’,1.5) 0034 legend(’cond(A)’,’cond(B)’,’Location’,’NorthWest’) 0035 xlabel(’n (Matrix Dimension)’); ylabel(’Conditioning Number’) 0036 title(’Conditioning vs Matrix Dimension - n = [0 15]’); grid 0037 %% Semilogarithmic Plot 0038 figure(3); set(gcf,’color’,’white’); 0039 semilogy(nn,Co_A,’b-’,nn,Co_B,’r--’,’LineWidth’,1.5) 0040 legend(’cond(A)’,’cond(B)’,’Location’,’NorthWest’) 0041 xlabel(’n (Matrix Dimension)’); ylabel(’Conditioning Number’) 0042 title({’Conditioning vs Matrix Dimension - n = [0 15]’,... 0043 ’Semilogarithmic Plot’}); grid 0044 %% Table 0045 disp(’ N cond(A) detdet_A cond(B) detdet_B’) 0046 disp(’-----------------------------------------------------------------’) 0047 disp([nn’,Co_A’,dppA’,Co_B’,dppB’])
Part 2: Results for n = 2 and n = 2 × { letters of my full name } = 2 × 13 = 26
A matix: 1 0. 0.5 0. B matix: 1.25 0. 0.66667 0. Condition number of the A matix: Condition number of the B matix: det(A)det(A^(-1))= 1 det(B)det(B^(-1))= 1
The results show that the condition number of A is 27 and of B is 529. We observe that cond (A) < cond (B) and that cond (A) is relatively closer to 1 than cond (B). This indicates that cond (A) is farthest from singularity and cond (B) is closest. Therefore A is better conditioned than B. Additionally, the results show that |A| ·
∣∣ A−^1
∣∣ and |B| ·
∣∣ B−^1
∣∣ are equal to 1, this implies that the inverse of the matrices has been calculated exactly. Thus, the condition numbers which depend on the inverse of the matrices are exact.
Condition number of the A matix: 8318594937975337000 Condition number of the B matix: 12042112043699638000
The results show that the condition number of A and B are very large numbers. This implies that both A and B are ill-conditioned.
Part 3: Results for n = [1 − 20]. Questions: What do you observe, and can you explain the trend? Does your program fail for a range of n? What is that range?
Figure 1: cond(A) and cond(B) vs n for n = [1 − 20]
(^00 5 10 15 )
1
2
3
4
5
6
7
8 x 10
19
n (Matrix Dimension)
Conditioning Number
Conditioning vs Matrix Dimension − n = [0 15] cond(A) cond(B)
Figure 2: Semilogarithmic plot of cond(A) and cond(B) vs n for n = [1 − 20]
(^100 5 10 15 ) 0
105
1010
1015
1020
n (Matrix Dimension)
Conditioning Number
Conditioning vs Matrix Dimension − n = [0 15] Semilogarithmic Plot cond(A) cond(B)
n ≥ 6 for cond (B) n ≥ 11 for cond (A)
cond (A) = ||A|| ·
∣∣ ∣
∣∣ ∣A−^1
∣∣ ∣
∣∣ ∣
The condition number of A^2 is:
cond
( A^2
∣∣ ∣
∣∣ ∣A^2
∣∣ ∣
∣∣ ∣ ·
∣∣ ∣
∣∣ ∣A−^2
∣∣ ∣
∣∣ ∣
The following property of matrix norms is recalled:
||M · N|| ≤ ||M|| · ||N||
By using the property above, it follows that:
cond
( A^2
) ≤ ||A||^2 ·
∣∣ ∣
∣∣ ∣A−^1
∣∣ ∣
∣∣ ∣
2
And therefore, the relationship between cond (A) and cond
( A^2
) can be expressed as:
cond
( A^2
) ≤ (cond (A))^2