MACM 316 COMPUTING ASSIGNMENT #3 Submit on Crowdmark by Tuesday, June 30, 2020, 11pm Upload one .pdf file with 2 pages: Page 1 is your typed report (your discussions, data and figures on a single...

1 answer below »
Please help me with the attached assignment, its due in 17 hours. Please help!


MACM 316 COMPUTING ASSIGNMENT #3 Submit on Crowdmark by Tuesday, June 30, 2020, 11pm Upload one .pdf file with 2 pages: Page 1 is your typed report (your discussions, data and figures on a single page); Page 2 is a listing of your code(s). The assignment is due at 11:00pm. You will receive a Crowdmark link for the upload. Matlab scripts and functions for this assignment can be downloaded from the Canvas Home- work page. Make sure to either set your “Matlab path”, or run Matlab in the directory where your scripts and functions are located. This computing assignment is an exploration of condition numbers, perturbations, and the numerical behaviour of random and not-so- random matrices. You will need to download gendata.p from Canvas to get all the data for the assignment, including the matrices E, H, HI, H8, and HI8 referred to below. (Note: gendata is encoded, displaying it will show a sequence of strange characters.) Run the script, and look at the work space or type whos to get a list of the data. For all your computations use � = 10−6 - a variable epsilon with the proper value is included in your data. C1. For A = E, A = H, compare the 1-condition number κ1(A) (in Matlab simply cond(A,1)) to the observed amplification in perturbations as well as to the Matlab estimate rcond(A). Note, that rcond(A) estimates the reciprocal 1/κ1(A). 1. Perturbations in the right-hand side. For each of these two matrices you will solve a total of 100 systems. You pair each right side b = B(:,j) with each perturbation direction d = D(:,k); note, that all column vectors in your data have length 1 in the || · ||1 norm. Compute (simply use the Matlab “\” backslash command) the solution of Ax = b, and Ay = b+ �d, and compare the amplification of the relative errors e = ||y−x||1 ||x||1 ||�d||1 ||b||1 = ||y − x||1 �||x||1 to the upper bound κ1(A). Look at the average, median, and maximum of the amplification factors. Describe your observations (supported by a plot), and comment on your results. See the sample below for a possible visualization. MRT 1 MACM 316 COMPUTING ASSIGNMENT #3 2. Perturbations of the matrix. For each of the two matrices E and H, solve a total of 60 linear systems to compute amplification factors. You use the same 10 right hand sides b from the first part; to get your perturbation matrices, type C=BIGC(:,:,k), for k = 1, . . . , 6. All the data matrices have ||C||1 = 1. Compute (simply use the Matlab “\” backslash command) the solution of Ax = b, and (A+ �C)z = b, and compare the amplification of the relative errors e = ||z−x||1 ||x||1 ||�C||1 ||A||1 = ||A||1 ||z − x||1 �||x||1 to the upper bound κ1(A) and the Matlab estimate 1/rcond(A). Look at averages, median, and maxima of amplification factors. Plot your results, and comment on your observations. C2. Short (and sweet - depending on your taste). Use the Matlab command AINV=inv(A) to find the inverse of a matrix A, and compute the inverse of this inverse, AC=inv(AINV), which mathematically equals A (= ( A−1 )−1. The matrix I is the identity matrix. 1. For A = E, compute ||A ∗AINV − I||1, and ||AC −A||1. 2. For A = H, compute ||A ∗ AINV − I||1, ||AC − A||1. For this matrix, also compare the computed inverse to the exact inverse HI provided, i.e., compute ||AINV −HI||1. 3. Repeat item 2 for the matrix A = H8 with exact inverse HI8. Compute κ1(H8). Summarize your observations and highlight anything that might seem surprising. MRT 2 MACM 316 COMPUTING ASSIGNMENT #3 Submit on Crowdmark by Tuesday, June 30, 2020, 11pm Upload one .pdf file with 2 pages: Page 1 is your typed report (your discussions, data and figures on a single page); Page 2 is a listing of your code(s). The assignment is due at 11:00pm. You will receive a Crowdmark link for the upload. Matlab scripts and functions for this assignment can be downloaded from the Canvas Home- work page. Make sure to either set your “Matlab path”, or run Matlab in the directory where your scripts and functions are located. This computing assignment is an exploration of condition numbers, perturbations, and the numerical behaviour of random and not-so- random matrices. You will need to download gendata.p from Canvas to get all the data for the assignment, including the matrices E, H, HI, H8, and HI8 referred to below. (Note: gendata is encoded, displaying it will show a sequence of strange characters.) Run the script, and look at the work space or type whos to get a list of the data. For all your computations use � = 10−6 - a variable epsilon with the proper value is included in your data. C1. For A = E, A = H, compare the 1-condition number κ1(A) (in Matlab simply cond(A,1)) to the observed amplification in perturbations as well as to the Matlab estimate rcond(A). Note, that rcond(A) estimates the reciprocal 1/κ1(A). 1. Perturbations in the right-hand side. For each of these two matrices you will solve a total of 100 systems. You pair each right side b = B(:,j) with each perturbation direction d = D(:,k); note, that all column vectors in your data have length 1 in the || · ||1 norm. Compute (simply use the Matlab “\” backslash command) the solution of Ax = b, and Ay = b+ �d, and compare the amplification of the relative errors e = ||y−x||1 ||x||1 ||�d||1 ||b||1 = ||y − x||1 �||x||1 to the upper bound κ1(A). Look at the average, median, and maximum of the amplification factors. Describe your observations (supported by a plot), and comment on your results. See the sample below for a possible visualization. MRT 1 MACM 316 COMPUTING ASSIGNMENT #3 2. Perturbations of the matrix. For each of the two matrices E and H, solve a total of 60 linear systems to compute amplification factors. You use the same 10 right hand sides b from the first part; to get your perturbation matrices, type C=BIGC(:,:,k), for k = 1, . . . , 6. All the data matrices have ||C||1 = 1. Compute (simply use the Matlab “\” backslash command) the solution of Ax = b, and (A+ �C)z = b, and compare the amplification of the relative errors e = ||z−x||1 ||x||1 ||�C||1 ||A||1 = ||A||1 ||z − x||1 �||x||1 to the upper bound κ1(A) and the Matlab estimate 1/rcond(A). Look at averages, median, and maxima of amplification factors. Plot your results, and comment on your observations. C2. Short (and sweet - depending on your taste). Use the Matlab command AINV=inv(A) to find the inverse of a matrix A, and compute the inverse of this inverse, AC=inv(AINV), which mathematically equals A (= ( A−1 )−1. The matrix I is the identity matrix. 1. For A = E, compute ||A ∗AINV − I||1, and ||AC −A||1. 2. For A = H, compute ||A ∗ AINV − I||1, ||AC − A||1. For this matrix, also compare the computed inverse to the exact inverse HI provided, i.e., compute ||AINV −HI||1. 3. Repeat item 2 for the matrix A = H8 with exact inverse HI8. Compute κ1(H8). Summarize your observations and highlight anything that might seem surprising. MRT 2
Answered Same DayJun 30, 2021

Answer To: MACM 316 COMPUTING ASSIGNMENT #3 Submit on Crowdmark by Tuesday, June 30, 2020, 11pm Upload one .pdf...

Kshitij answered on Jul 02 2021
119 Votes
repertubation/data.mat
B:[6x10 double array]
BIGC:[6x6x6 double array]
C:[6x6 double array]
D:[6x10 double array]
E:[6x6 double array]
H:[6x6 double array]
H8:[8x8 double array]
HI:[6x6 double array]
HI8:[8x8 double array]
epsilon:[1x1 double array]
repertubation/MATLAB CODE.docx
MATLAB CODE
%
The data set
clear all, clc
close all
load data
% C1. For A = E, A = H, compare the 1-condition number ?1(A) (in Matlab simply cond(A,1))
% to the observed amplification in perturbations as well as to the Matlab estimate rcond(A).
% Note, that rcond(A) estimates the reciprocal 1=?1(A).

A=E;
C1=cond(A,1);
% Reciprical
format short
R1=1/C1;
R1m=rcond(A);

if(abs(R1-R1m) disp(['The reciprical is match for E']);
else
disp(['The reciprical is Not match E']);
end

clear A
A=H;
C2=cond(A,1);
% Reciprical
format short
R2=1/C2;
R2m=rcond(A);

if(abs(R2-R2m) disp(['The reciprical is match For H']);
else
disp(['The reciprical is Not match H']);
end
% 1. Perturbations in the right-hand side.
% For each of these two matrices you will solve a total of 100 systems. You pair each right
% side b = B(:,j) with each perturbation direction d = D(:,k); note, that all column
% vectors in your data have length 1 in the jj · jj1 norm. Compute (simply use the Matlab
% "n" backslash command) the solution of

A=E;
[ii,j]=size(B);
i=0;
for k=1:j
for ll=1:j
b=B(:,ll);
d=D(:,k);

x=A\b;
y=A\(b+epsilon*d);
i=i+1;
e(i)=norm(y-x,1)/(epsilon*norm(x,1));
end
end
disp(['For matrix A=E'])
disp(['The average := ', num2str(mean(e))])
disp(['The median := ', num2str(median(e))])
disp(['The maximum := ', num2str(max(e))])
figure(),
plot(1:j*j,e,'r*','linewidth',2); grid on
xlabel('j'); ylabel('e');
title('For atrix A=E');

clear A e x ii j y i
A=H;
[ii,j]=size(B);
i=0;
for k=1:j
for ll=1:j
b=B(:,ll);
d=D(:,k);

x=A\b;
y=A\(b+epsilon*d);
i=i+1;
e(i)=norm(y-x,1)/(epsilon*norm(x,1));
end
end
disp(['For matrix A=H'])
disp(['The average := ', num2str(mean(e))])
disp(['The median := ', num2str(median(e))])
disp(['The maximum := ', num2str(max(e))])
figure(),
plot(1:j*j,e,'r*','linewidth',2); grid on
xlabel('j'); ylabel('e');
title('For atrix A=H');
% 2. Perturbations of the matrix.
% For each of the two matrices E and H, solve a total of 60 linear systems to compute
% amplification factors. You use the same 10 right hand sides b from the first part; to
% get your perturbation matrices, type C=BIGC(:,:,k), for k = 1; : : : ; 6. All the data
% matrices have jjCjj1 = 1. Compute (simply use the Matlab “n” backslash command) the solution of

clear A e j x

A=E;
[n,n1,m]=size(BIGC);
[i,j]=size(B);
ii=0;
for k=1:m
for l=1:j
C=BIGC(:,:,k);
b=B(:,l);
x=A\b;
z=(A+epsilon*C)\b;
ii=ii+1;
ee(ii)=norm(A,1)*norm(z-x,1)/(epsilon*norm(x,1));
end
end
disp(['For matrix A=E'])
disp(['The average := ', num2str(mean(ee))])
disp(['The median := ', num2str(median(ee))])
disp(['The maximum := ',...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here