Macaulay2 » Documentation
Packages » Permutations :: inversions
next | previous | forward | backward | up | index | toc

inversions -- computes the inversions of a permutation

Synopsis

Description

A permutation $p$ has an inversion $(i,j)$ if $i < j$ and $p(i) > p(j)$. inversions computes all of the inversions of a permutation.

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

o1 = Permutation{3, 1, 2, 5, 4}

o1 : Permutation
i2 : inversions p

o2 = {{1, 2}, {1, 3}, {4, 5}}

o2 : List

See also

Ways to use inversions:

For the programmer

The object inversions is a method function.