[Previous] [Next] [Contents]

[ImplState=stable,TestState=stable,DocState=stable]

combinat::permutations::cycles -- cycle decomposition of standard permutations

Introduction

Functions related to cycle decomposition of standard permutations.

Details

Method cycles: cycle decomposition of a standard permutation

Method cycleType: cycle type of a standard permutation

Method fromCycles: standard permutation from its cycle decomposition

Method fixedPoints: list of the fixed points of a standard permutation

Method fixedPointsNumber: number of fixed points of a standard permutation

Example 1

The cycles of a permutation can be computed with:

>> combinat::permutations::cycles([3,5,1,2,4]);
     
                            [[1, 3], [2, 5, 4]]
        

You can recover the initial permutation by two different ways, forgetting or not the cycle of length 1:

>> combinat::permutations::fromCycles([[1, 3], [2, 5], [4]]),
   combinat::permutations::fromCycles([[1, 3], [2, 5]]);
     
                     [3, 5, 1, 4, 2], [3, 5, 1, 4, 2]
        

You can generate the list of permutations with a given cycle type, which is a conjugacy class of the symmetric group, and then check that their number corresponds to the usual formula:

>> select(combinat::permutations::list(4),
     z-> combinat::permutations::cycleType(z)=[2,2]);
   nops(%), 4!/(2^2*2!);
     
                [[2, 1, 4, 3], [3, 4, 1, 2], [4, 3, 2, 1]]
      
                                   3, 3
        

Example 2

To compute the list or the number of fixed points of a permutation, you can use:

>> combinat::permutations::fixedPoints([6, 7, 3, 8, 5, 9, 2, 1, 4]);
   combinat::permutations::fixedPointsNumber([6, 7, 3, 8, 5, 9, 2, 1, 4]);
     
                                  [3, 5]
      
                                     2
        

It can be used to quickly get an estimation of the number of permutations without fixed points, using the following main block inside a loop, and check the hats paradox:

>> combinat::permutations::fixedPoints(combinat::permutations::random(20)); 
     
                                   [13]
        

[Previous] [Next] [Contents]


MuPAD Combinat, an open source algebraic combinatorics package