In[]:=
Sat 4 Jan 2025 15:59:40
Verify solution of Xiangxiang: https://math.stackexchange.com/a/5017119/998
Use P1 and P2 formulas
Parent: linear-estimation-scratch-2025.nb/Chris DeSa xiangxiang verify 04jan25
Use P1 and P2 formulas
Parent: linear-estimation-scratch-2025.nb/Chris DeSa xiangxiang verify 04jan25
In[]:=
Clear["Global`*"];Needs["MaTeX`"];numSamples=100000;trs[A_,s_Integer]:=With[{As=MatrixPower[A,s]},Tr[As]];norms[A_,s_Integer]:=With[{As=MatrixPower[A,s]},];sample[d_]:=Module[{A},A=N@IdentityMatrix[d];Do[LinearAlgebra`LAPACK`LARF["R",v,1.,A],{v,Normalize/@RandomVariate[NormalDistribution[],{d,d}]}];A];Needs["Notation`"];Notation⟺s0=2;d0=3;SF=StringForm;Print[SF["s=``, d=``, numSamples=``",s0,d0,numSamples]];eval[func_]:=(N@Mean@Table[func/.{A->sample[d0],d->d0,s->s0},{numSamples}]);formula1=(d^2+d-2)/2*(1-2/d+2/(d*(d+2)))^d-(d^2-d)/2*(1-2/d)^d+(1-1/d)^d;formula2=(d^2+2d)/3*(1-2/d+3/(d*(d+2)))^d-(d^2-d)/3*(1-2/d)^d;formulas={Tr[],Tr[],formula1,formula2};Unprotect[MaTeX];MaTeX[Tr[]]=MaTeX["\\operatorname{Tr} A^s "];MaTeX[Tr[]]=MaTeX["\\operatorname{Tr}(AA^T)^s"];vals=Table[eval/@formulas,{10}];TableForm[vals,TableHeadings->{{},(MaTeX/@formulas[[;;2]])~Join~{"formulaP1","formulaP2"}}]GraphicsRow@MaTeX[{"\\text{formulaP1 =}",formula1}]GraphicsRow@MaTeX[{"\\text{formulaP2 =}",formula2}]
2
Norm[As,"Frobenius"]
s
A
s
(A.A)
s
A
s
(A.A)
s=2, d=3, numSamples=100000
Out[]//TableForm=
formulaP1 | formulaP2 | |||
0.692547 | 0.683769 | 0.693333 | 0.684444 | |
0.692136 | 0.684885 | 0.693333 | 0.684444 | |
0.69336 | 0.686362 | 0.693333 | 0.684444 | |
0.694073 | 0.684083 | 0.693333 | 0.684444 | |
0.694847 | 0.685155 | 0.693333 | 0.684444 | |
0.695242 | 0.683373 | 0.693333 | 0.684444 | |
0.69355 | 0.683157 | 0.693333 | 0.684444 | |
0.691748 | 0.684751 | 0.693333 | 0.684444 | |
0.694269 | 0.684857 | 0.693333 | 0.684444 | |
0.693769 | 0.684539 | 0.693333 | 0.684444 |
Out[]=
Out[]=