# Wolfram Language™

## Circular Ensembles (COE, CUE, ...)

The circular ensembles are families of unitary matrices with distributions invariant under different unitary transformations. Typical applications are in statistical mechanics, number theory, combinatorics, and nuclear physics.

Matrices from the circular real ensemble (CRE) are orthogonal. »

In:= `cre = RandomVariate[CircularRealMatrixDistribution];`
In:= `OrthogonalMatrixQ[cre]`
Out= Matrices from the circular unitary ensemble (CUE) are unitary. »

In:= `cue = RandomVariate[CircularUnitaryMatrixDistribution];`
In:= `UnitaryMatrixQ[cue]`
Out= Matrices from the circular orthogonal ensemble (COE) are symmetric and unitary. »

In:= `coe = RandomVariate[CircularOrthogonalMatrixDistribution];`
In:= `SymmetricMatrixQ[coe] && UnitaryMatrixQ[coe]`
Out= Matrices from the circular symplectic ensemble (CSE) are self-dual unitary quaternionic. »

show complete Wolfram Language input
In:= ```selfdualQuaternionicQ[m_] := With[{\[ScriptCapitalJ] = KroneckerProduct[{{0, -1}, {1, 0}}, IdentityMatrix[Length[m]/2]], mat = SetAccuracy[m, 10]}, Transpose[mat].\[ScriptCapitalJ] == \[ScriptCapitalJ].mat];```
In:= `cse = RandomVariate[CircularSymplecticMatrixDistribution];`
In:= `UnitaryMatrixQ[cse] && selfdualQuaternionicQ[cse]`
Out= Matrices from the circular quaternion ensemble (CQE) are symplectic unitary. »

show complete Wolfram Language input
In:= ```symplecticMatrixQ[mat_] := With[{\[ScriptCapitalJ] = KroneckerProduct[{{0, -1}, {1, 0}}, IdentityMatrix[Length[mat]/2]] }, Conjugate[mat].\[ScriptCapitalJ] == \[ScriptCapitalJ].mat];```
In:= `cqe = RandomVariate[CircularQuaternionMatrixDistribution];`
In:= `UnitaryMatrixQ[cqe] && symplecticMatrixQ[cqe]`
Out= Eigenvalues of matrices from CUE, COE, and CSE have unit length and are uniformly distributed in phase.

show complete Wolfram Language input
In:= ```args = Flatten[ Arg[RandomVariate[ MatrixPropertyDistribution[Eigenvalues[x], x \[Distributed] #], 10^4]]] & /@ {CircularUnitaryMatrixDistribution, CircularOrthogonalMatrixDistribution, CircularSymplecticMatrixDistribution}; Row[MapThread[ Histogram[#1, {-Pi, Pi, Pi/10}, Frame -> None, ChartLegends -> Placed[#2, Above]] &, {args, {Style["Unitary", 15], Style["Orthogonal", 15], Style["Symplectic", 15]}}]]```
Out= Visualize the joint distribution of the phase of the eigenvalues from two-dimensional CUE and compare it with the actual density.

In:= ```evs\[ScriptCapitalD] = MatrixPropertyDistribution[Arg[Eigenvalues[x]], x \[Distributed] CircularUnitaryMatrixDistribution]; \[CurlyPhi]s = RandomSample /@ RandomVariate[evs\[ScriptCapitalD], 10^5];```
show complete Wolfram Language input
In:= ```Show[ Histogram3D[\[CurlyPhi]s, {-Pi, Pi, 0.25}, PDF, PlotTheme -> "Scientific", ChartStyle -> "AvocadoColors"], Plot3D[1/(8 Pi^2) Abs[Exp[I \[Phi]1] - Exp[I \[Phi]2]]^2, {\[Phi]1, -Pi, Pi}, {\[Phi]2, -Pi, Pi}, PlotStyle -> None, MeshStyle -> Thick], ImageSize -> Medium]```
Out= 