In[]:=
(*deployswithcanonicalname*)​​
CompoundExpression[
]
​​deploy
Tue 18 Jul 2023 11:24:06

Purity of a random matrix product

In[]:=
purity[mat_]:=With{x=SingularValueList[mat]},n
Total[
4
x
]
2
Total[
2
x
]
;​​n=1000;​​maxK=10;​​​​sample:=RandomVariate@@{dist,{n,n}};​​​​normal=NormalDistribution[];​​uniform=UniformDistribution[{-1,1}];​​​​dist=normal;matsNormal=NestList[#.sample&,sample,maxK-1];​​dist=uniform;​​matsUniform=NestList[#.sample&,sample,maxK-1];​​​​observedPlot=ListPlot[(purity/@#)&/@{matsNormal,matsUniform},PlotLegends->{"Normal entries","Uniform entries"}];​​​​predictedPlot=Plot[k+1,{k,1,maxK},​​PlotLegends->{"k+1"},PlotStyle->Gray];​​​​SF=StringForm;​​Show[observedPlot,predictedPlot,AxesLabel->{"k","purity"},PlotLabel->SF["Product of k n-x-n matrices with n=``",n]]​​
Out[]=
Normal entries
Uniform entries
k+1

Mixing products from different distributions

In[]:=
uniformSample=RandomVariate[uniform,{n,n}];​​normalSample=RandomVariate[normal,{n,n}];​​purity[uniformSample.normalSample]
Out[]=
3.00212
In[]:=
purity[uniformSample]+purity[normalSample]-1
Out[]=
2.99985