algebraMacros.pl - a set of functions that are useful in an algebra/number theory problems
fisher-yates shuffle
argument: reference to a list shuffles list in-place
returns: nothing
extended euclidean algorithm
arguments: a, b
returns: d, x, y, s, t where gcd( a, b ) = d = a( x + sk ) + b( y + tk ) for all k
subroutine to decompose a permutation into a product of disjoint cycles.
argument: reference to a list containing the permutation data that is, element 0 of the list is f(0), element 1 is f(1), etc
returns: mathObject list of lists representing the cycle decomposition of the permutation
subroutine to decompose a permutation into a product of transpositions ( 2-cycles ).
argument: mathObject list of lists representing the cycle decomposition of the permutation (i.e., the output of disjointCycles() )
returns: mathObject list of lists representing the permutation as a list of transpositions
subroutine to determine the order of a permutation
argument: a list of lists representing a permutation in the form of a product of disjoint cycles ( i.e., the output of disjointCycles() )
returns: mathObject integer representing the order of the permutation
subroutine to determine the parity of a permutation
argument: a list of lists representing a permutation in the form of a product of disjoint cycles (i.e., the output of disjointCycles() )
returns: TRUE if the permutation is even, FALSE if the permutation is odd