Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4, Let\'s play with the idea of ill-conditioning for a 9 × 9 systern Ar = B. Fir

ID: 2895606 • Letter: 4

Question

4, Let's play with the idea of ill-conditioning for a 9 × 9 systern Ar = B. First, create A that is all ones except for 1.0l's on the main diagonal: A ones (9,9); for j-1:9 1.01 ; A(j,j) end = Let B-(1:9y (a) Solve the system using the backslash command and call the result rl (b) Perturb the matrix A slightly by multiplying A(5.3) by 1.02 (a 2% change): A (5,3)- A(5,3)-1.02 Solve the system using the backslash command and call the result 2 (c) Compare r1 and 2 by printing each value and the absolute value of the difference for each j = 1 : 9, Then check the overall effect by computing the relative error: norn (x1-x2)/norm(x1) Answer the question: A 2% change in one element causes a-% change in the overall solution. Is there evidence of ill-conditioning? If there is, how would you rate the severity of the problem? (d) Now consider Cz-B, where B is the same, but C is a 9 × 9 matrix that is all ones except for 10's on the main diagonal. Solve the system and call the solution y (e) Perturb the matrix by multiplying C(5,3) by 1.02. Solve the system and call the solution y2 (f) Repeat part c. A 2% change in one element causes a-% change in the overall solution. Is there evidence of ill-conditioning? If there is, how would you rate the severity of the problem? (g) Now compute the condition numbers of the unperturbed matrices A and C to see how they eompare

Explanation / Answer

clc;
clear all;
close all;

A=ones(9,9);

for i=1:9
A(i,i)=1.01;
end
A1=A;
B=(1:9)';
x1=BA;

%%% b)
A(5,3)=A(5,3)*1.02;
x2=BA;

% % c)

err=abs(x1-x2);
rel_err=norm(x1-x2)/norm(x1);
fprintf('c)2 percent change in one element cause %f percent change in solution ',rel_err*100);

fprintf('If you obsevered the absolute error value its very small which means introducing small change in any value not affect the solution. Thus There is no ill conditioned observerd ')


% % d)
C=ones(9,9);

for i=1:9
C(i,i)=10;
end
C1=C;
y1=BC;

% % e)
C(5,3)=C(5,3)*1.02;
y2=BC;

err1=abs(y1-y2);
rel_err1=norm(y1-y2)/norm(y1);

fprintf('f)2 percent change in one element cause %f percent change in solution ',rel_err1*100);

fprintf('If you obsevered the absolute error value its very small which means introducing small change in any value not affect the solution. Thus There is no ill conditioned observerd ')
cond_A=cond(A1)
cond_C=cond(C1)

OUTPUT:

c)2 percent change in one element cause 0.073992 percent change in solution
If you obsevered the absolute error value
its very small which means introducing small change in any value not affect the solution.
Thus There is no ill conditioned observerd
f)2 percent change in one element cause 0.035861 percent change in solution
If you obsevered the absolute error value
its very small which means introducing small change in any value not affect the solution.
Thus There is no ill conditioned observerd

cond_A =

901.0000


cond_C =

2.0000

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote