Previous Up Next

6.9.9  Product of two permutations: p1op2 c1op2 p1oc2 c1oc2

Permutations are functions, and so can be composed. Since cycles can be represented differently than other permutations, there are commands for composing permutations of different types.


Warning.
Composition is done using the standard mathematical notation; that is, the function given as the second argument is performed first.


The p1op2 command composes two permutations.


Example.
Input:

p1op2([3,4,5,2,0,1],[2,0,1,4,3,5])

Output:


5,3,4,0,2,1


The c1op2 command composes a cycle and a permutation.


Example.
Input:

c1op2([3,4,5],[2,0,1,4,3,5])

Output:


2,0,1,5,4,3


The p1oc2 command composes a permutation and a cycle.


Example.
Input:

p1oc2([3,4,5,2,0,1],[2,0,1])

Output:


4,5,3,2,0,1


The c1oc2 command composes two cycles.


Example.
Input:

c1oc2([3,4,5],[2,0,1])

Output:


1,2,0,4,5,3

Previous Up Next