- (a) (3 points) Solve the following system using GEPP (Gaussian elimination with partial pivoting):
31A = 42 | 1342 | 34 44 | 154 171688 = 168 |
Show intermediate matrices, vectors and multipliers at each step.
(b) (2 points) Compute the LU factorization of the matrix in the previous question with partial pivoting: PA = LU. You have to show intermediate results at each step. This question and the previous one can be answered together.
Note: Do the computations by your hands and dont consider any rounding errors.
- (3 points) Suppose we have a complex linear system Ax = b, where A Cnn is nonsingular and b Cn. Can you solve it in real arithmetic operations? What is the cost?
Hint: Rewrite Ax = b as an equivalent 2n 2n real linear system.
- Suppose A Rnn is nonsingular.
- (4 points) Given B Rnp, show how to use the LU factorization with partial pivoting to solve AX = B. What is the cost of your method?
Hint: AX = B is equivalent to AX(:,j) = B(:,j) for j = 1 : p.
- (5 points) Use m given in the lecture notes to solve AX = B, where 10 10 Hilbert matrix A = (aij), aij = 1/(i + j 1);
10 5 B = A randn(10,5).
Here randn is a MATLAB built-in function to generate a random matrix. Denote this randn(10,5) by Xt and your computed solution by Xc.
- Compute kXc XtkF/kXtkF and kAkFkA1kF, where is the machine epsilon. Check MTALAB built-in functions or constants norm, cond and eps, to see how to compute or get related quantities.
- Compute the relative residual kB AXcompkF/(kAkFkXcompkF).
- Run your code 10 times (you may use a loop). Notice each time you have differentB, since Xtrue is random. Answer the following questions:
- Do you see any rough relation between kXc XtkF/kXtkF and kAkFkA1kF? iii. Do you see any rough relation between kB AXckF/(kAkFkXckF) and ?
Print out your MATLAB code and the results.
1
(c) Computing A1
- (3 points) Show how to use the LU factorization with partial pivoting to computethe inverse of a general n n nonsingular matrix A. What is the cost of your method? (Hint: Think about what matrix equation AX = B you should solve to get A1).
Compute the inverse of a 5 5 Hilbert matrix defined in 3(b). Print out your MATLAB code and the result.
- (3 bonus points) For the sake of simplicity, suppose we use the LU factorizationwith no pivoting to compute A1. Briefly state an algorithm which costs 2n3 You need to explain why its cost is 2n3 flops.
2
Reviews
There are no reviews yet.