Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. Suppose A Rnxn is nonsingular. (a) (4 points) Given B Rm*p, show how to use the LU factorization with partial pivoting to solve AX-
3. Suppose A Rnxn is nonsingular. (a) (4 points) Given B Rm*p, show how to use the LU factorization with partial pivoting to solve AX- B. What is the cost of your method? Hint: AXBis equivalent to AX(:,j)-B(:, j) for j 1:p (b) (5 points) Use lupp.m given in the lecture notes to solve AX - B, where 10 x 10 Hilbert matrix A - (a ai 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 |Xe XllF/XllF and elIAllFlA- F, where e 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 |B - AXcomp F/(AlF) i. Run your code 10 times (you may use a loop). Notice each time you have different B, since Xtrue is random. Answer the following questions: i1. Do you see any rough relation between Xc- XtF/ XF and eAF iii. Do you see any rough relation between |[B-AXcIF/dlAllFlKJIF) and e? IA IF? Print out your MATLAB code and the results 3. Suppose A Rnxn is nonsingular. (a) (4 points) Given B Rm*p, show how to use the LU factorization with partial pivoting to solve AX- B. What is the cost of your method? Hint: AXBis equivalent to AX(:,j)-B(:, j) for j 1:p (b) (5 points) Use lupp.m given in the lecture notes to solve AX - B, where 10 x 10 Hilbert matrix A - (a ai 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 |Xe XllF/XllF and elIAllFlA- F, where e 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 |B - AXcomp F/(AlF) i. Run your code 10 times (you may use a loop). Notice each time you have different B, since Xtrue is random. Answer the following questions: i1. Do you see any rough relation between Xc- XtF/ XF and eAF iii. Do you see any rough relation between |[B-AXcIF/dlAllFlKJIF) and e? IA IF? Print out your MATLAB code and the results
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started