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

Basic operations -- an overview of basic operations with permutations

Two permutations $p$ and $q$ are equal if they are equal as functions, i.e., if $p(i) = q(i)$ for all $i$.

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

o1 = Permutation{3, 1, 2}

o1 : Permutation
i2 : q = permutation {3,1,2,4,5}

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

o2 : Permutation
i3 : p == q

o3 = true

We can also multiply (or compose) two permutations. We follow the convention of $(p*q)(i) = p(q(i))$.

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

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

o4 : Permutation
i5 : q = permutation {2,1,3,4,5}

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

o5 : Permutation
i6 : p*q

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

o6 : Permutation

This also let's us compute powers of permutations.

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

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

o7 : Permutation
i8 : p^2

o8 = Permutation{2, 3, 1}

o8 : Permutation
i9 : p^6

o9 = Permutation{1}

o9 : Permutation
i10 : p^0

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

o10 : Permutation
i11 : p^(-1)

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

o11 : Permutation
i12 : p^(-2)

o12 = Permutation{3, 1, 2}

o12 : Permutation

The source of this document is in Permutations/Documentation/packageDocs.m2:95:0.