Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago