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

# Creating permutations -- an overview of creating permutations

Permutations are constructed from lists. To create a permutation, use the permutation method:

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

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

    o1 : Permutation

Permutations must be constructed from lists consisting of only the integers $1 \textemdash n$. If a list contains any other elements or does not consist of the entire range, then an error is thrown. The method matrix(Permutation) can be used to get the matrix representation of the permutation. In this representation, for a permutation $p$, if $p(i)=j$, then then the $(i,j)$th entry is $1$.

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

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

    o2 : Permutation

    i3 : matrix p

    o3 = | 0 1 0 0 0 |
         | 0 0 1 0 0 |
         | 1 0 0 0 0 |
         | 0 0 0 1 0 |
         | 0 0 0 0 1 |

                  5       5
    o3 : Matrix ZZ  <-- ZZ

This is especially useful for considering the action of permutations on matrices, see Group actions.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Permutations/Documentation/packageDocs.m2:63:0.