Question: 1. Write a computer program to solve a linear system by the Gaussian elimination with partial pivoting. Your programs should take a matrix A and

 1. Write a computer program to solve a linear system by

1. Write a computer program to solve a linear system by the Gaussian elimination with partial pivoting. Your programs should take a matrix A and a vector b as inputs and produce an approximate solution to Az-b and the relative residual as the outputs, where the relative residual is the maximum entry of the residual r = b-Ar in absolute value divided by the product of the maximum entry of A and the maximum entry of b all in absolute values. Apply your program to solve the linear system Ax = b where A [ and b = [b] with ay = (1 + i)/-1, and bi = (1 + i)n-1. Then, the exact solution is known to be = 2 = ...-Zn-1 because L;i-l aij--1 (1+i),-1 = 0+)--1 = bi . Test your code using n = 5, n = 10 and n = 20 Print the computed solution vectors and the corresponding maximum residual entry. Briefly discuss your results with respect to the theory on the accuracy of the solution and the residual error. 2. (Bonus) Repeat Problem 1, but use the method of Cramer's rule. You need to write a function to compute the determinant of a square matrix using the definition recursively. You are not allowed to use the Gaussian elimination to compute the determinant. For the same reason, you are not allowed to use MATLAB's built-in function (det.m) for computing the determinant, which is based on the Gaussian elimination. For this part, also use tic and toc to track the CPU time required by Cramer's rule and Gaussian elimination - kill the job if it takes more than 24 hours

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!