Wolfram Language

Random Matrices

Longest Increasing Subsequences

The number of permutations of elements in which the longest increasing subsequence is at most of length can be computed by averaging over , where are matrices drawn from CircularUnitaryMatrixDistribution of dimension .

Click for copyable input
{k, n} = {6, 2};

Define the matrix property distribution and calculate the mean.

Click for copyable input
\[ScriptCapitalD] = MatrixPropertyDistribution[Abs[Tr[\[ScriptCapitalU]]]^( 2 k), \[ScriptCapitalU] \[Distributed] CircularUnitaryMatrixDistribution[n]]; N[Mean[\[ScriptCapitalD]]]

Compare with the direct count.

Click for copyable input
Count[Permutations[Range[k]], perm_ /; Length[LongestOrderedSequence[perm]] <= n]

For , the distribution of the scaled lengths of the longest increasing subsequences of random permutations converges to the TracyWidom distribution with .

Click for copyable input
sample[n_] := 1/n^(1/6) (Table[ Length[LongestOrderedSequence[ RandomSample[Range[n]]]], {2000}] - 2.0 Sqrt[n]);

Compare the smooth histogram of sampled scaled lengths for increasing dimensions with the PDF of the TracyWidom distribution.

show complete Wolfram Language input
Click for copyable input
dims = {1000, 5000, 10000}; Show[ SmoothHistogram[sample /@ dims, PlotLegends -> (Row[{"n = ", #}] & /@ dims)], Plot[PDF[TracyWidomDistribution[2], x], {x, -4, 2}, PlotStyle -> {Black, Dashed, Thick}, PlotLegends -> {"Tracy-Widom distribution"}]]

Related Examples

de es fr ja ko pt-br ru zh