Docsity

Esercizi su Algebra Lineare e Geometria - Computing: Eigenvalues, Singular Values e Metodi, Esercizi di Algebra Lineare e Geometria Analitica

Toggle sidebar
bg1
Linear Algebra and Geometry - Scientific Computing
Exercise session 4
Topics: eigenvalues and singular values
1. Use the command eig to compute the eigenvalues of the following n×nmatrices:
A1=
n n −1n−2· · · 321
n−1n−1n−2· · · 321
0n−2n−2· · · 321
.
.
..
.
........
.
..
.
..
.
.
0.
.
.......321
0.
.
.......221
0 0 · · · · · · 011
, A2=
n n −1n−2· · · 321
n−1n−1n−2· · · 321
n−2n−2n−2· · · 321
.
.
..
.
........
.
..
.
..
.
.
3.
.
.......321
2.
.
.......221
1 1 · · · · · · 111
.
with n= 100.
Subsequently, introduce a perturbation = 1.0e−10 to the last row elements of both matrices and
compute the eigenvalues of the perturbed matrices. Graphically represent the eigenvalues and justify
the results.
2. Implement power iteration method using a function called powerIt.m. Fix the maximum number of
iterations m max to be executed and relative precision tol. Subsequently, starting form the vector
z= (1,2,3)T, using a tolerance tol=1e-10 find the the eigenvalue of largest modulus of the following
matrices:
A1=
120
100
010
, A2=
0.1 3.8 0
1 0 0
0 1 0
, A3=
0−1 0
100
010
.
Justify the results using the Matlab command eig.
3. Implement power iteration method without vector-normalization using a function called powerIt noNorm.m.
Subsequently, starting form the vector z= (1,2,3)Tand using a tolerance tol=1e-10 determine the
eigenvalue of largest modulus and a corresponding eigenvector of the matrix A2of previous exercise.
Fix m max=500,800,1100 and comment the result.
4. Implement the inverse power method using a function called InvPowerIt.m (modify the algorithm
implemented in powerIt.m). Subsequently, apply InvPowerIt.m in order to find the eigenvalue closest
to p= 0.5 of the following matrices
A1=
1−2 0
020
113
, A2=
0.5−2 0
0 2 0
1 1 3
, A3=
0−2 0
010
113
.
Use the Matlab function eigs.m and comment the results from InvPowerIt.m .
5. Find an appropriate pfor computing the eigenvalue of maximum modulus of the matrix
A=
5 0 1 −1
0 2 0 −1
2
0 1 −1 1
−1−1 0 0
.
by means of Gershgorin’s circles properties. Compare the number of iterations and the computational
cost of the power method and the inverse power method setting a tolerance tol = 1−14
1
pf2

Anteprima parziale del testo

Scarica Esercizi su Algebra Lineare e Geometria - Computing: Eigenvalues, Singular Values e Metodi e più Esercizi in PDF di Algebra Lineare e Geometria Analitica solo su Docsity!

Linear Algebra and Geometry - Scientific Computing

Exercise session 4

Topics: eigenvalues and singular values

  1. Use the command eig to compute the eigenvalues of the following n × n matrices:

A 1 =

n n − 1 n − 2 · · · 3 2 1

n − 1 n − 1 n − 2 · · · 3 2 1

0 n − 2 n − 2 · · · 3 2 1

. . .

, A 2 =

n n − 1 n − 2 · · · 3 2 1

n − 1 n − 1 n − 2 · · · 3 2 1

n − 2 n − 2 n − 2 · · · 3 2 1

. . .

with n = 100.

Subsequently, introduce a perturbation  = 1. 0 e − 10 to the last row elements of both matrices and

compute the eigenvalues of the perturbed matrices. Graphically represent the eigenvalues and justify

the results.

  1. Implement power iteration method using a function called powerIt.m. Fix the maximum number of

iterations m max to be executed and relative precision tol. Subsequently, starting form the vector

z = (1, 2 , 3) T , using a tolerance tol=1e-10 find the the eigenvalue of largest modulus of the following

matrices:

A 1 =

 , A

 , A

Justify the results using the Matlab command eig.

  1. Implement power iteration method without vector-normalization using a function called powerIt noNorm.m.

Subsequently, starting form the vector z = (1, 2 , 3)

T and using a tolerance tol=1e-10 determine the

eigenvalue of largest modulus and a corresponding eigenvector of the matrix A 2 of previous exercise.

Fix m max=500,800,1100 and comment the result.

  1. Implement the inverse power method using a function called InvPowerIt.m (modify the algorithm

implemented in powerIt.m). Subsequently, apply InvPowerIt.m in order to find the eigenvalue closest

to p = 0.5 of the following matrices

A 1 =

 , A

 , A

Use the Matlab function eigs.m and comment the results from InvPowerIt.m.

  1. Find an appropriate p for computing the eigenvalue of maximum modulus of the matrix

A =

1 2 0 1 − 1 1

− 1 − 1 0 0

by means of Gershgorin’s circles properties. Compare the number of iterations and the computational

cost of the power method and the inverse power method setting a tolerance tol = 1 − 14

  1. Implement QR method (elementary form) in a function named qr basic.m; fix a maximum iterations

number m max and the following stopping criterion: norm(tril(A,-1),inf)<=toll, where tol is an

input argument of the function. Apply this method to the 10-order Hilbert matrix, using m max=

and tol=1.0e-14. Compute the error linked to these eigenvalues, using as correct values the ones from

eig command. After that, execute 100 iterations of QR method applied to the following matrix:

A =

Comment the results.

  1. Select format long e. Define upper-triangular matrices A of order n = 5, 10 , 15 , · · · , 100 , whose

elements are

aij =

1 for i = j

− 1 , for i < j

0 , for i > j

Compute the determinant, the rank and the singular values of the matrix A and comment the results.

  1. Let A 15-order Hilbert matrix andAx = b with b such that the exact solution x is a vector of all

ones. Solve the above system with the Matlab command x=A\b and with singular values decomposition

applied with an less-rank approximation of A obtained neglecting singular values smaller than tolerance

tol = 10

− 12

. Compare relative errors of the two methods.

  1. Consider the following linear system:

3 x 1 − 2 x 2 + x 3 + 2x 4 = 1

−x 1 + 2x 3 + x 4 = − 3

5 x 2 − 6 x 3 − x 4 = 7

x 1 + x 2 − x 3 + x 4 = 0

x 1 − x 2 − x 3 − x 4 = − 6

8 x 1 − x 2 + 5x 3 + 2x 4 = 2

Compute the rank of the matrix of the coefficients of the system. Subsequently, compute the solution

of the system in the least-squares sense, having minimum euclidean norm. Verify the result using the

Matlab command pinv. What are all the solutions of the system in the least-squares sense?

  1. Use the SVD decomposition to approximate the image dog.jpg, generated from blackness matrix with

dimensions 271×300, by means of a matrix of rank n = 10, 30 , 50 , 70.