({{, (RefLink[CircularRealMatrixDistribution, paclet:ref/CircularRealMatrixDistribution])[n] 
represents a circular real matrix distribution with matrix dimensions {n,n}.}})

OpenersNotesSection(Spacer1)Details

(RefLink[CircularRealMatrixDistribution, paclet:ref/CircularRealMatrixDistribution]) is also known as circular real ensemble, or CRE.

(RefLink[CircularRealMatrixDistribution, paclet:ref/CircularRealMatrixDistribution]) represents a uniform distribution over the orthogonal square matrices of dimension n, also known as the Haar measure on the orthogonal group O(n).

The dimension parameter n can be any positive integer.

(RefLink[CircularRealMatrixDistribution, paclet:ref/CircularRealMatrixDistribution]) can be used with such functions as (RefLink[MatrixPropertyDistribution, paclet:ref/MatrixPropertyDistribution]) and (RefLink[RandomVariate, paclet:ref/RandomVariate]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (9)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Generate a random CRE matrix:

RandomVariate[CircularRealMatrixDistribution[3]]

Verify that the matrix is orthogonal:

OrthogonalMatrixQ[%]

Sample a random point on a sphere using (RefLink[MatrixPropertyDistribution, paclet:ref/MatrixPropertyDistribution]):

RandomVariate[MatrixPropertyDistribution[r.{0,0,1},r\[Distributed]CircularRealMatrixDistribution[3]]]

The distribution of points over the sphere is uniform:

Point[RandomVariate[MatrixPropertyDistribution[r.{0,0,1},r\[Distributed]CircularRealMatrixDistribution[3]],10^3]]//Graphics3D

OpenersExampleSection1(Spacer1)Scope  (3)

Generate a single random orthogonal matrix:

RandomVariate[CircularRealMatrixDistribution[2]]

Generate a set of random orthogonal matrices:

RandomVariate[CircularRealMatrixDistribution[2],3]

Compute statistical properties numerically:

det𝒟=MatrixPropertyDistribution[Det[𝓂],𝓂\[Distributed]CircularRealMatrixDistribution[4]];

NProbability[Δ==1,Δ\[Distributed]det𝒟]

NProbability[Δ==-1,Δ\[Distributed]det𝒟]

OpenersExampleSection3(Spacer1)Applications  (2)

Sample (RefLink[EulerAngles, paclet:ref/EulerAngles]) of random special orthogonal matrices in 3D:

EulerAngles𝒟=MatrixPropertyDistribution[EulerAngles[𝓂/Det[𝓂]],𝓂\[Distributed]CircularRealMatrixDistribution[3]];

angles=RandomVariate[EulerAngles𝒟,10^4];

Check that the sample agrees with the expected distribution:

DistributionFitTest[angles,ProductDistribution[UniformDistribution[{-Pi,Pi}],ProbabilityDistribution[(1/2)Sin[θ],{θ,0,Pi}],UniformDistribution[{-Pi,Pi}]]]

Visualize histograms of individual angles:

Histogram[#,Automatic,PDF]&/@Transpose[angles]

Sample points on (S^3) by randomly rotating a fixed 4D vector:

p4d=RandomVariate[MatrixPropertyDistribution[r.UnitVector[4,4],r\[Distributed]CircularRealMatrixDistribution[4]],5 10^4];

AllTrue[p4d,RegionMember[Sphere[4]]]

Project the points to (S^2)×(S^1) by Hopf map, for which the uniform measure on (S^3) induces uniform measure on (S^2)×(S^1):

hopf={x,y,z,w}|->{(ArcTan[x,y]+Pi)/(2Pi),2(x z+y w),2(y z-x w),x^2+y^2-z^2-w^2};

Simplify[Norm[Rest[hopf[x,y,z,w]]],{x,y,z,w}∈Sphere[4]]

Simplify[Det[Grad[hopf[x,y,z,w],{x,y,z,w}]],{x,y,z,w}∈Sphere[4]]

Project the points and bin them by the first coordinate of the projection:

proj=hopf@@@p4d;
res=GatherBy[SortBy[proj,First],Quotient[First[#],0.05]&];
res=Drop[res,None,None,1];

Visualize the points on (S^2) at different angles on (S^1):

Animate[Graphics3D[{PointSize[Small],Point[res[[k]]]},PlotRange->{{-1,1},{-1,1},{-1,1}}],{{k,1,"ϕ"},1,Length[res],1},TrackedSymbols:>k,SaveDefinitions->True,AnimationRunning->False]

OpenersExampleSection4(Spacer1)Properties & Relations  (2)

Distribution of phase angle of the eigenvalues:

dim=300;
args=RandomVariate[MatrixPropertyDistribution[Arg[Eigenvalues[x]],x\[Distributed]CircularRealMatrixDistribution[dim]],100];

Histogram[Join@@args,{-Pi,Pi,2Pi/40},PDF]

Compute the spacing between eigenvalues:

diffs=Join@@Map[Composition[Differences,Sort],(args/(2Pi))dim];

Compare the histogram of sample level spacings with the closed form, also known as Wigner surmise for Dyson index β==2:

WignerSurmisePDF[x_,β:2]:=2(4 x/Pi)^2 Exp[(-4/Pi) x^2]

Show[Histogram[diffs,{0.1},PDF],Plot[WignerSurmisePDF[x,2],{x,0,2.5}]]

For eigenvectors of (RefLink[CircularRealMatrixDistribution, paclet:ref/CircularRealMatrixDistribution]) with dimension n large, the scaled modulus of the elements is (χ^2) distributed:

𝒟=MatrixPropertyDistribution[Flatten[Abs[Eigenvectors[𝓂]]^2],𝓂\[Distributed]CircularRealMatrixDistribution[50]];

data=2Normalize[Join@@RandomVariate[𝒟,100],Mean];

Compare the histogram with (RefLink[PDF, paclet:ref/PDF]) of (RefLink[ChiSquareDistribution, paclet:ref/ChiSquareDistribution]):

Show[Histogram[data,"Scott",PDF],Plot[PDF[ChiSquareDistribution[2],x],{x,0,9}]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[CircularOrthogonalMatrixDistribution, paclet:ref/CircularOrthogonalMatrixDistribution])  ▪  (RefLink[CircularUnitaryMatrixDistribution, paclet:ref/CircularUnitaryMatrixDistribution])  ▪  (RefLink[CircularSymplecticMatrixDistribution, paclet:ref/CircularSymplecticMatrixDistribution])  ▪  (RefLink[CircularQuaternionMatrixDistribution, paclet:ref/CircularQuaternionMatrixDistribution])  ▪  (RefLink[MatrixPropertyDistribution, paclet:ref/MatrixPropertyDistribution])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Matrix Distributions, paclet:guide/MatrixDistributions])}, {▪(RefLinkPlain[Random Variables, paclet:guide/RandomVariables])}})}})