Matlab: Linear Algebra ----------------------- Practical Exercises ------------------- Session 2 (Numerical Linear Algebra) ------------------------------------ 2.1 Set the matrix A to the following value: -0.2762 0.0060 0.4593 0.2513 0.1991 0.0472 -0.2449 0.3909 -0.3614 Create a row vector B with the following value: 0.4049 -0.3889 0.0949 And a column vector C with the following value: -0.3152 -0.0611 -0.0913 Solve the equations B = A*x and C = A*y, and multiply the results by A to check that you get back to B and C. Print the condition number and the LAPACK approximate condition number of A. 2.2 Solve the equation B = A*x, and multiply the result by A to check that you get back to B. Note the errors. Print the condition number, the LAPACK approximate condition number and eigenvalues of A. Note the large values and the large number of small eigenvalues. 2.3 Set the matrix C to the following value: 0.2127 -0.4576 0.0005 -0.4286 -0.0289 0.0216 -0.4404 -0.4033 0.1820 0.3181 Set the matrix D to the following value: -0.3501 0.1596 0.0186 0.4730 0.1490 Solve the equation D = C*x. 2.4 There are no answers to this question, and I suggest leaving it until later. However, unless you are a matrix expert, I advise doing it before using either the '/' or '\' operators with two matrix arguments. Alternatively, avoid doing that. Create two 3x3 random matrices A and B, and investigate the relationships between linsolve(x,y), x/y and x\y, with x and y being either A and B or B and A. Use the formulae given in the lecture as a starting point. The objective is to get a firm understanding of exactly what the '/' or '\' operators actually do on matrices. 2.5 Create a vector E of length 16 with the Nth element having value cos(pi*(N-1)/4). Set F to be its Fast Fourier Transform. Print F and the inverse transform of F. 2.6 Create an unsymmetric 5x5 matrix G by [G,y] = eig(hilb(5)). Print its 2-D fast Fourier transform using fftn, and then using fft. Do the latter by row and column, and then by column and row. All of those should be the same, and there are other variations using transposition. 2.7 Set the matrix A to the following value: -0.2762 0.0060 0.4593 0.2513 0.1991 0.0472 -0.2449 0.3909 -0.3614 Set B to the exponential of Z, and C to that of -Z. Print B, C and B times C and C times B. Calculate eye(3)+A+A^2/2+A^3/6+A^4/24+A^5/120 and note the slight differences from B. Calculate the trace of A, both by using the trace function and by summing the diagonal. 2.8 Using the matrix A above, calculate D to be A times A transpose. [Note that D is now symmetric ] Print D's 2-norm and determinant. Print its eigenvalues, their product, the singular values and their product. Note the relationships to each other, and to the norm and determinant. Print its characteristic polynomial. 2.9 Using the matrix A above (i.e. the original input), print its 2-norm and determinant. Print its eigenvalues, their product, and the singular values. Note the relationships to each other, and to the norm and determinant. [Note that A is not normal ] Print its 1-norm, infinity-norm and eigenvalue condition numbers. 2.10 Using the matrix D above, print its eigenvectors and singular value decomposition. Note the relationships (i.e. they are the same results, rearranged). Use the relationships given in the lecture to recreate the matrix D from the eigenvalues and eigenvectors, and the singular value decomposition. 2.11 Using the matrix A above, print its eigenvectors and singular value decomposition. Note the relationships, and that they differ. [Note that I said A was not normal. ] Use the relationships given in the lecture to recreate the matrix D from the eigenvalues and eigenvectors, and the singular value decomposition.