Discrete helpers/perm

This class implements s of the non-negative integers.

finite permutations
A permutation is only determined by the moved elements. Fixed points make no difference.

The main attribute of this class is. Attributes with derived information are  and.

inversions
See Inversion (discrete mathematics). The  is the set of places on which the values are out of order. The  is the reverse colexicographic rank. Its factoradic expression is the left inversion count. The  is the lexicographic rank. Its factoradic expression is the right inversion count.

inverse
The product of a permutation and its inverse is the neutral permutation. (Same as exponentiation with &minus;1.)

cycles
The usual cycle notation of a permutation as a list of lists.

is a set partition (see SetPart).

order
Smallest positive exponent that produces the identity. (LCM of cycle lengths.)

0 Perm 1 Perm(0, 1, 2], [4, 5) 2 Perm(0, 2, 1) 3 Perm(4, 5) 4 Perm(0, 1, 2) 5 Perm(0, 2, 1], [4, 5) 6 Perm

parity
Parity of the number of inversions. 

[0, 1, 2, 3] | 0 | 0 [1, 0, 2, 3] | 1 | 1 [0, 2, 1, 3] | 1 | 1 [2, 0, 1, 3] | 0 | 2 [1, 2, 0, 3] | 0 | 2 [2, 1, 0, 3] | 1 | 3 [0, 1, 3, 2] | 1 | 1 [1, 0, 3, 2] | 0 | 2 [0, 3, 1, 2] | 0 | 2 [3, 0, 1, 2] | 1 | 3 [1, 3, 0, 2] | 1 | 3 [3, 1, 0, 2] | 0 | 4 [0, 2, 3, 1] | 0 | 2 [2, 0, 3, 1] | 1 | 3 [0, 3, 2, 1] | 1 | 3 [3, 0, 2, 1] | 0 | 4 [2, 3, 0, 1] | 0 | 4 [3, 2, 0, 1] | 1 | 5 [1, 2, 3, 0] | 1 | 3 [2, 1, 3, 0] | 0 | 4 [1, 3, 2, 0] | 0 | 4 [3, 1, 2, 0] | 1 | 5 [2, 3, 1, 0] | 1 | 5 [3, 2, 1, 0] | 0 | 6

Schoute permutation
Periodic permutation derived from a finite one. See Schoute permutation.



sequence
The permutation can be represented by a sequence of the required length or longer. The example  requires length 6 or more, because the biggest moved element is 5.

apply on vector
The result of applying a permutation on a sequence in natural order looks like the inverse of the permutation.



periodic permutations
A periodic permutation moves an infinite number of elements, but with a repeating pattern. Most attributes are those of the smallest corresponding finite permutation. The new attribute  is the period length.

For both permutations  is 2,   is   and   is. These are the results of  and  :

[0, 1, 2, 4, 3, 5, 6, 7, 9, 8, 10, 11, 12, 14, 13, 15, 16, 17, 19, 18] [0, 1, 2, 4, 3, 5, 6, 7, 8, 9, 10, 11, 12, 14, 13, 15, 16, 17, 18, 19]

is a method only for periodic permutations, and shows the cycles for a given length:

Schoute permutations and Walsh permutations (see WalshPerm) are periodic.