Macaulay2 » Documentation
Packages » Permutations :: Ascents, descents, runs, exceedances, and records
next | previous | forward | backward | up | index | toc

Ascents, descents, runs, exceedances, and records -- a detailed overview of permutations in Macaulay2

A permutation $p=(p_1 \, \dots \, p_n)$ has an ascent at $i$ (for $i < n$) if $p(i) < p(i+1)$. Similarly, it has a descent at $i$ (for $i < n$) if $p(i) > p(i+1)$. We can compute the set of ascents and the set of descents using ascents and descents, respectively.

i1 : p = permutation {3,1,2,5,4};
i2 : ascents p

o2 = {2, 3}

o2 : List
i3 : descents p

o3 = {1, 4}

o3 : List

An ascending run is a maximal subsequence of successive ascents. Similarly, a descending run is a maximal subsequence of successive descents.

i4 : p = permutation {3,1,2,5,4};
i5 : ascendingRuns p

o5 = {1 : (3), (1, 2, 5), 1 : (4)}

o5 : List
i6 : descendingRuns p

o6 = {(3, 1), 1 : (2), (5, 4)}

o6 : List

A permutation $p=(p_1 \, \dots \, p_n)$ has an exceedance at $i$ if $p(i) > i$; this is called a weak exceedance if the inequality is not strict, i.e., $p(i) \geq i$.

i7 : p = permutation {3,1,2,5,4};
i8 : exceedances p

o8 = {1, 4}

o8 : List

A permutation $p$ has a saliance at $i$ if $p(j) < p(i)$ for all $j > i$.

i9 : p = permutation {3,1,2,5,4};
i10 : saliances p

o10 = {4, 5}

o10 : List

A permutation $p$ has a record at $i$ if $p(j) < p(i)$ for all $j < i$.

i11 : p = permutation {3,1,2,5,4};
i12 : records p

o12 = {1, 4}

o12 : List

The source of this document is in /build/reproducible-path/macaulay2-1.25.06+ds/M2/Macaulay2/packages/Permutations/Documentation/packageDocs.m2:247:0.