Question: Write MATLAB computer code that compares Gauss Elimination without Partial Pivoting to Gauss Elimination with partial pivoting on any n x n system (your code

Write MATLAB computer code that compares Gauss Elimination without Partial Pivoting to Gauss Elimination with partial pivoting on any n x n system (your code needs to work regardless of the size of the matrix). Use it to solve the following system of equations: -X1 + 3x2 + 2x3-3x4-3X5 + 4Xs + 2x, + 7x8 = 1 20000X1 + 20000X2-10000OX3-50000X4 + 10000X5-20000X7 + 50000X8 =-1 100000X1 100000x2 + 9990X3 - 40000X4 30000xs + 20000X6 10000X7+ 60000xs 2 -2X1 + 4x2+ 1x3 + 3x4 + 3x5 + 7x, + 2x8 =-2 1X1 + 3X2 + 2X3 + 7X4 +2X6+ 2X7+ 4X8 3 0.000001X1 + 0.0000032 0.000002X3 0.0000004X4 - 0.0000001xs 0.000001Xs0.000002X7 + 0.000002X8-100 10X1 - 5X2 + 5X3 - 8X4 7Xs + 4X 6X7 3X8 -3 2X1 5X2 2X3 14X46X5 7X62X79X8 4 a) Find the X values without partial pivoting. What are they? b) Now, multiply the original A matrix by the x-vector that you solved for and subtract that result from the original b-vector to find the error in the b-vector. What is this error in the b-vector? c) Now calculate the same error in the b-vector when you solve for the X values with Gauss Elimination with partial pivoting. What is the error in the b-vector with partial pivoting? How does it compare it to your answer for part b)? Explain your results. d) How many times did your code have to pivot? In other words, how many times did your code have to exchange rows? Write MATLAB computer code that compares Gauss Elimination without Partial Pivoting to Gauss Elimination with partial pivoting on any n x n system (your code needs to work regardless of the size of the matrix). Use it to solve the following system of equations: -X1 + 3x2 + 2x3-3x4-3X5 + 4Xs + 2x, + 7x8 = 1 20000X1 + 20000X2-10000OX3-50000X4 + 10000X5-20000X7 + 50000X8 =-1 100000X1 100000x2 + 9990X3 - 40000X4 30000xs + 20000X6 10000X7+ 60000xs 2 -2X1 + 4x2+ 1x3 + 3x4 + 3x5 + 7x, + 2x8 =-2 1X1 + 3X2 + 2X3 + 7X4 +2X6+ 2X7+ 4X8 3 0.000001X1 + 0.0000032 0.000002X3 0.0000004X4 - 0.0000001xs 0.000001Xs0.000002X7 + 0.000002X8-100 10X1 - 5X2 + 5X3 - 8X4 7Xs + 4X 6X7 3X8 -3 2X1 5X2 2X3 14X46X5 7X62X79X8 4 a) Find the X values without partial pivoting. What are they? b) Now, multiply the original A matrix by the x-vector that you solved for and subtract that result from the original b-vector to find the error in the b-vector. What is this error in the b-vector? c) Now calculate the same error in the b-vector when you solve for the X values with Gauss Elimination with partial pivoting. What is the error in the b-vector with partial pivoting? How does it compare it to your answer for part b)? Explain your results. d) How many times did your code have to pivot? In other words, how many times did your code have to exchange rows
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
