BAP: Lecture 2 (feb 12, 2002)

The notes for this lecture are available in
The main topic of this lecture was the condition number of a matrix. Standard references on Numerical Linear Algebra that discuss the condition number are: Material that inspired this lecture may be found in
All of the matlab code used in this lecture may be found on the BAP matlab code directory. The following are the matlab code used to generate some of the experiments performed in class, and some of those that should have been. Download the code and try some out!
for i = 1:10000,
  a = randn(32);
  d(i) = min(svd(a));
end

d = sort(d);

clf
plot([1:10000]/10000,d)


A = 2*eye(32) - tril(ones(32));
min(svd(A))

for i = 1:10000,
  a = A + randn(32)/100;
  dp(i) = min(svd(a));
end

dp = sort(dp);
hold on;
plot([1:10000]/10000,dp,'r')


clf;

for i = 1:10000,
  a = (rand(32) < .3);
  d(i) = min(svd(a));
end
d = sort(d);
plot([1:10000]/10000,d)


clf;

for i = 1:100000,
  a = ((rand(32) < 1/2)-1/2)/100 ;
  d(i) = min(svd(a));
end


for i = 1:100000,
  a = ((rand(32) < 1/2)-1/2)/100 + A;
  dp(i) = min(svd(a));
end
dp = sort(dp);

hold on
plot(dp,'r')


D = zeros(10);
E = crossedGrid(D,1)  %% a 1 at the end plots it!

A = graph2A(E);
min(abs(eig(A)))

for i = 1:10000,
  D = (rand(10) < 1/2);
  E = crossedGrid(D,0);
  A = graph2A(E);
d(i) = min(abs(eig(A)));
end

d = sort(d);
clf
plot(d)