In[]:=
CompoundExpression[
]
​​deploy
Sat 17 Feb 2024 22:23:02
Parent: free-probability.nb​
Related discussion: “random shuffling” on mathoverflow post (mathoverflow-simplified-sgd.nb)​
Disentangling lemma: from “Lecture 3: Golden-Thompson and the Frobenius inner product” paperpile​
​
math.SE post - Showing
ETr(AA
T
A
T
A
)
3
n
+2n
In[]:=
(*Fitsformulaoftheforman+b
2
n
+...*)​​getIntegerFormula[seq_]:=getIntegerFormula[seq,Length[seq]];​​getIntegerFormula[seq_,order_]:=Module[{form,lvals,coef},​​form=Total[coef[#]
#
n
&/@Range[order]];​​lvals=Table[form,{n,Length[seq]}];​​form/.First@Solve[lvals==seq]​​];

Numeric moments

Second moment

Out[]//TableForm=
n
value
1
3
2
12
3
33
4
72
5
135
6
228

Third moment

In[]:=
Clear[a];​​getThirdMoment[n_]:=(​​A=Array[a,{n,n}];​​distSpec=#NormalDistribution[]&/@Variables[A];​​Expectation[Tr[A.A.A.A.A.A],distSpec]​​);​​seq=Table[{n,getThirdMoment[n]},{n,1,5}];​​TableForm[seq,TableHeadings->{{},{"n","value"}}]​​
Out[]//TableForm=
n
value
1
15
2
64
3
183
4
432
5
895

Enumerate paths

In[]:=
Clear[a];​​n=2;​​A=Array[a[Min[#1,#2],Max[#1,#2]]&,{n,n}];​​A=Array[a,{n,n}];​​SeedRandom[1];​​subVars[p_]:=With[{vars=Variables[p]},Thread[varsRandomInteger[{-5,5},Length[vars]]]];​​​​(*Splitstermlike2xinto{2,x},and"x"into{1,x*)​​split[term_]:=Module[{},​​result=(term/.a0_Integer*b0_->{a0,b0});​​If[Head@result===List,result,{1,result}]​​];​​​​termList=List@@Expand@Tr[A.A.A.A];​​​​(*returnsTrueifthetermhasanevenpower*)​​positiveTerm[term_]:=Count[{term},
b0_?EvenQ
a0_
]>0;​​positiveTermList=Select[termList,positiveTerm];​​{counts,terms}=Transpose[split/@termList];​​​​distSpec=#NormalDistribution[]&/@Variables[A];​​val[term_]:=Expectation[term,distSpec];​​​​vals=val/@terms;​​poses=Flatten@Position[vals,_?Positive];​​val[Tr[A.A.A.A]]​​TableForm[{counts[[poses]],terms[[poses]],vals[[poses]]}]​​

Related moment formulas

Mathematica q https://mathematica.stackexchange.com/questions/293600/recovering-formulas-for-sequences-with-integer-coefficients
​

Normalized entries

Out[]//TableForm=
Tr[A.A]
{1,1,1,1,1}
1
Tr[A.
T
A
]
{1,2,3,4,5}
n
Tr[A.A.A.A]
3,2,
5
3
,
3
2
,
7
5

1+
2
n
Tr[A.A.
T
A
.A]
3,
5
2
,
7
3
,
9
4
,
11
5

2+
1
n
Tr[A.A.
T
A
.
T
A
]
3,3,
11
3
,
9
2
,
27
5

2
n
+n
Tr[A.
T
A
.A.
T
A
]
{3,5,7,9,11}
1+2n

Standard Normal entries

Out[]//TableForm=
Tr[A.A]
{1,2,3,4,5}
n
Tr[A.
T
A
]
{1,4,9,16,25}
2
n
Tr[A.A.A.A]
{3,8,15,24,35}
2n+
2
n
Tr[A.A.
T
A
.A]
{3,10,21,36,55}
n+2
2
n
Tr[A.A.
T
A
.
T
A
]
{3,12,33,72,135}
2n+
3
n
Tr[A.
T
A
.A.
T
A
]
{3,20,63,144,275}
2
n
+2
3
n
In[]:=
Clear[a,A,n];​​getMoment[n_,expr_]:=(​​traceExpr=Tr[expr]/.A->Array[a,{n,n}];​​distSpec=#NormalDistribution[0,1]&/@Variables[traceExpr];​​Expectation[traceExpr,distSpec]​​);​​exprs={A.A.A.A.A.A,A.A.A.A.A.A,A.A.A.A.A.A,A.A.A.A.A.A};​​getMomentSequence[expr_]:=Table[getMoment[n,expr],{n,1,5}];​​table=Table[​​With[{seq=getMomentSequence[expr]},​​{TraditionalForm@expr,TraditionalForm[seq],getIntegerFormula[seq]}],​​{expr,exprs}];​​TableForm[table]
Out[]//TableForm=
A.A.A.A.A.A
{15,48,105,192,315}
8n+6
2
n
+
3
n
T
A
.
T
A
.A.
T
A
.A.A
{15,80,273,720,1595}
4n+8
2
n
+
3
n
+2
4
n
A.A.A.
T
A
.
T
A
.
T
A
{15,64,183,432,895}
4n+10
2
n
+
4
n
A.
T
A
.A.
T
A
.A.
T
A
{15,144,603,1728,3975}
4
2
n
+6
3
n
+5
4
n

Two variable traces

Out[]//TableForm=
Tr[A.A.A.A]
{3,8,15,24,35}
2n+
2
n
Tr[A.A.B.B]
{1,2,3,4,5}
n
Tr[A.A.
T
A
.
T
A
]
{3,12,33,72,135}
2n+
3
n
Tr[A.B.
T
B
.
T
A
]
{1,8,27,64,125}
3
n

Two variable norms

Out[]//TableForm=
2
A.
T
A

{3,20,63,144}
2
n
+2
3
n
2
A.B
{1,8,27,64}
3
n
2
A.B.
T
B
.
T
A

{9,168,1053,4032}
-72n+150
2
n
-102
3
n
+33
4
n
In[]:=
SF=StringForm;​​headers=SF["n=``",#]&/@Range[4];​​vals={9,168,1053,4032};​​TableForm[Transpose[{headers,vals}]]
Out[]//TableForm=
n=1
9
n=2
168
n=3
1053
n=4
4032

With 3 variables

Answered in https://mathoverflow.net/questions/459694/expected-norm-of-a-product-of-gaussian-matrices
By Carlo Beenakker
Out[]//TableForm=
s=1
1
4
9
16
s=2
1
8
27
64
s=3
1
16
81
256
s=4
1
32
243

Wick’s automatic calculation

Disentangling Lemma

math.SE https://math.stackexchange.com/questions/4818437/showing-e-operatornametraaatate-operatornametraataat-for-gaus
From https://homes.cs.washington.edu/~jrl/teaching/cse599Isp21/notes/lecture3.pdf

Just the permutations of even