Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

and to the one that you get in MATLAB by typing A ? ? b ( which d 0 e s d 0 partial pivoting

and to the one that you get in MATLAB by typing A??b(which d0esd0
partial pivoting).
Transcribed Image Text: and to the one that you partial pivoting). CHAPTER 7 t in MATLAB by typing A)b (which does do
Let
A=([10-16,1],[1,1]) and b=([2],[3])
Here we will see the effect of using a tiny element as a pivot. % Gaussian elimination without pivoting
% for solving linear systems Ax=b
%
%A =[123; 456; 780]; b =[102]';
%A =[2110; 4331; 8795; 6798]; b =[2345]'; % another example
n = size(A,1);
%
%---------------------------------------------%
% This is Step 1 of Gaussian Elimination
%----------------------------------------------%
%
for i=2:n % Loop over rows below row 1
mult = A(i,1)/A(1,1); % Subtract this multiple of row 1 from
% row i to make A(i,1)=0.
A(i,:)= A(i,:)-mult*A(1,:); %(this line is equivalent to the "for loop:
% for k=1:n, A(i,k)= A(i,k)-mult*A(1,k); end; ")
b(i)= b(i)- mult*b(1);
end
U = A % display U
%
%
%----------------------------------------------%
% All steps of Gaussian elimination
%----------------------------------------------%
%
A =[123; 456; 780]; b =[102]';
%A =[2110; 4331; 8795; 6798]; b =[2345]'; % another example
n = size(A,1);
for j=1:n-1% Loop over columns.
for i=j+1:n % Loop over rows below j.
mult = A(i,j)/A(j,j); % Subtract this multiple of row j from
% row i to make A(i,j)=0.
A(i,:)= A(i,:)- mult*A(j,:); % This does more work than necessary! WHY?
b(i)= b(i)- mult*b(j);
end
end % the resulting A is an upper triangular matrix
U = A % display U
%
%
%----------------------------------------------%
% Modified Gaussian elimination
%(to avoid recomputing zeros)
%----------------------------------------------%
%
A =[10^-161; 11]; b =[2; 3];
%A =[123; 456; 780]; b =[102]';
%A =[2110; 4331; 8795; 6798]; b =[2345]'; % another example
n = size(A,1);
for j=1:n-1% Loop over columns.
for i=j+1:n % Loop over rows below j.
mult = A(i,j)/A(j,j); % Subtract this multiple of row j from
% row i to make A(i,j)=0.
A(i,j:n)= A(i,j:n)- mult*A(j,j:n); % modified! no more recomputing of
% of zeros in columns 1 to j-1 and rows j to n.
b(i)= b(i)- mult*b(j);
end
end % the resulting A is an upper triangular matrix
U = A % display U
(a) By hand, solve the linear system Ax=b exactly. Write your answer in
a form where it is clear what the approximate values of x1 and x2 are.
(b) In MATLAB, enter the matrix A and type cond(A) to determine the
2-norm condition number of A. Would you say that this matrix is well
conditioned or ill conditioned in the 2-norm?
(c) Write a MATLAB code (or use one from the text) that does not do
partial pivoting to solve the linear system Ax=b. Compare the
answer returned by this code to the one that you determined by hand
image text in transcribed

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions