# Wolfram Language™

## Tracy–Widom Distribution

TracyWidom distribution is the limiting distribution of the scaled largest eigenvalue of a random matrix belonging to Gaussian ensembles. It also appears in various different disciplines, such as counting problems, random growth models, phase transitions, etc., and gives accurate predictions.

TracyWidom distribution consists of three classes , , and . Each corresponds to different Gaussian ensembles; see the corresponding PDFs.

show complete Wolfram Language input
In:= ```Plot[Table[ PDF[TracyWidomDistribution[\[Beta]], x], {\[Beta], {1, 2, 4}}] // Evaluate, {x, -5, 2}, Filling -> Axis, PlotLegends -> {"\[Beta] = 1", "\[Beta] = 2", "\[Beta] = 4"}, ImageSize -> Medium, PlotTheme -> "Detailed"]```
Out= Use MatrixPropertyDistribution to represent the scaled largest eigenvalue of a matrix from GUE.

In:= ```ev\[ScriptCapitalD][2, n_] := MatrixPropertyDistribution[(Max[Eigenvalues[x]] - 2 Sqrt[n]) n^(1/6), x \[Distributed] GaussianUnitaryMatrixDistribution[n]]```

Sample from the distribution and compare the histogram with the PDF.

In:= `sample = RandomVariate[ev\[ScriptCapitalD][2, 250], 2000];`
show complete Wolfram Language input
In:= ```Show[Histogram[sample, {0.2}, PDF, PlotTheme -> "Detailed"], Plot[PDF[TracyWidomDistribution, x ], {x, -5, 2}, PlotStyle -> Thick, PlotTheme -> "Detailed", PlotLegends -> None], ImageSize -> Medium]```
Out= TracyWidom distribution can be well approximated by gamma distribution in the central region.

In:= ```gdist = GammaDistribution[k, s, 1, a]; PDF[gdist, x]```
Out= Fit gamma distribution with TracyWidom distribution of by matching the first three moments.

In:= ```moments = Through[{Mean, Variance, Skewness}[gdist]]; nmoments = N[Through[{Mean, Variance, Skewness}[TracyWidomDistribution]]]; sol = FindRoot[Thread[moments == nmoments], {{k, 1}, {s, 1}, {a, 1}}]```
Out= Compare the PDFs.

show complete Wolfram Language input
In:= ```Plot[{PDF[gdist /. sol, x], PDF[TracyWidomDistribution, x]} // Evaluate, {x, -5, 2}, PlotLegends -> {"Gamma distribution", "Tracy-Widom distribution"}, Filling -> Axis, PlotTheme -> "Detailed", ImageSize -> Medium]```
Out= 