$30
Questions:
1. Consider the problem
x1 − x2 +3x3 = 2 x1 + x2 = 4 3x1 −2x2 + x3 = 1
Carry out Gaussian elimination in its simplest form for this problem. What is the resulting upper triangular matrix?
Proceed to find the solution by backward substitution.
2. Let
(a) The matrix A can be decomposed using partial pivoting as
PA = LU
where U is upper triangular, L is unit lower triangular, and P is a permutation matrix. Find the 4 x 4 matrices U, L, and P.
(b) Given the right-hand-side vector b=(26,9,1,−3)T, find x that satisfies Ax = b. (Show your method: do not just guess.)
3. Implement the Power Method in Python by writing a program that inputs a matrix A ∈ Rnxn and an initial guess vector v0 ∈ Rn. Use your code to find an eigenvector of matrix given below, starting with the initial guess vectors v0 = (1,2,−1)T and v0 = (1,2,1)T
Report the first 5 iterates for each of the two initial vectors. Then find eigenvalues and eigenvectors of A (you can use numpy.linalg.eig[1]). Where do the sequences converge to? Why do the limits not seem to be the same?
Note: You can use NumPy package in Python for the implementation.
4. In this question you will play with one picture (see Figure 1) that can be found in homework’s attachment in Ninova (clown.bmp).
(a) Write a Python code for computing the truncated SVD of this image. Start with rank r = 2 and go up by powers of 2, to r = 64. For a compact presentation of your figures, use the matplotlib subplots[2] for each of the pictures, with 3(nrows) and 2(ncols) as the first two arguments.
(b) Comment on the performance of the truncated SVD for each of the pictures. State how much storage is required as a function of r and how much storage is required for the original picture.
Note: You can use NumPy, matplotlib, opencv packages in Python for the implementation.
Figure 1: Clown image.
[1] https://numpy.org/doc/stable/reference/generated/numpy.linalg.eig.html
[2] https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.subplots.html