Condition Number of Random Matrices

We have various ways of making random matrices.

ConditionNumber[A_,2]:= (Abs[Eigenvalues[A,{1}]]/Abs[Eigenvalues[A,-1]])[[1]]
n=23;
Sample=1000;
Histogram[
Table[
A= RandomReal[{-1,1},{n,n}];
A=A.Transpose[A];
Log[10,ConditionNumber[A,2]],
{Sample}],
Frame->True,
FrameLabel->{"(Subscript[Log, 10])[C[A]]","count"},
PlotLabel->"A.A"
]

ConditionNumber[A_,2]:= (Abs[Eigenvalues[A,{1}]]/Abs[Eigenvalues[A,-1]])[[1]]
n=23;
Sample=1000;
Histogram[
Table[
A= RandomReal[{-1,1},{n,n}];
Log[10,ConditionNumber[A,2]],
{Sample}],
Frame->True,
FrameLabel->{"(Subscript[Log, 10])[C[A]]","count"},
PlotLabel->"A"
]

Theorem 2.4.1

Lets see how the condition number compares to the error. for the same sort of some matrices.  The residual in a floatin point solve in Mathematica is basically down at (10^(-16))

n=23;
Sample=100;
ListLogLogPlot[
Table[
A= RandomReal[{-1,1},{n,n}];
A=A.Transpose[A];
x0=RandomReal[{-1,1},n];
b=A.x0;
x=LinearSolve[A,b];
{ConditionNumber[A,2],Norm[x-x0]},
{Sample}],
GridLines->Automatic,
PlotLabel->"A.A",
Frame->True,
FrameLabel->{"C[A]","||x-x0(Subscript[||, 2])"}
]

n=23;
Sample=1000;
ListLogLogPlot[
Table[
A= RandomReal[{-1,1},{n,n}];
x0=RandomReal[{-1,1},n];
b=A.x0;
x=LinearSolve[A,b];
{ConditionNumber[A,2],Norm[x-x0]},
{Sample}],
GridLines->Automatic,
PlotLabel->"A",
Frame->True,
FrameLabel->{"C[A]","||res(Subscript[||, 2])"}
]

L1 Condition Number Estimate p132

L1CondEst[A_]:= Module[{LSolveFn,NormA,n=Length[A],w,Data,SampleSize=10000},
LSolveFn=LinearSolve[A];
NormA=Norm[A,1];
Data=Table[
w=RandomReal[{-1,1},{n}];
((Norm[LSolveFn[w],1])/(Norm[w,1])),
{SampleSize}];
Norm[A]*Max[Data]
]

n=3;
A=RandomReal[{-1,1},{n,n}];
Norm[A,1]*Norm[Inverse[A],1]
L1CondEst[A]

Looking at the sampled data we see that there is a thin tail.  This sort of explains why the condition estimates come out quite as low as they do. We are unlikely to hit a vector out in the thin tail randomly.

Histogram[Data]