iconEuler Reference



Functions for permutations.


Load this file with "load perm".

pn := 10;
function pid (n)
  Identity permutation of n elements.
function pmult (p,q)
  Multiply two permutations.
function operator pm (p,q)
  Multiply two permutations.
  >pprint ptranspose(2,3,10) pm ptranspose(3,4,10)
  (2 3 4)
function ptranspose (i,j,n=none)
  Transposition of i and j in n elements.
function prefix pprint (p)
  Print a permutation as product of cycles.
function pcycle (q,n=none)
  Transform a cycle q into a permutation of n elements.
function pinverse (p)
  Inverse of the permutation p.
function pmultcycles 
  Multiply all cycles in the argument list (right to left).
function forAllPerm (f,n)
  Run f(p) for all permutations p of n elements.
function forAllChoices (f,n,m)
  Run f(p) for all choices p of m elements out of 1:n
function forAllTrips (f,n)
  Run f(p) for all trips p of n elements.
function forAllOrderedChoices (f,n,m)
  Run f(p) for all ordered tuples of m elements in 1 to n.

Documentation Homepage