NAME

algebraMacros.pl - a set of functions that are useful in an algebra/number theory problems

FUNCTIONS

fyshuffle

fisher-yates shuffle

argument: reference to a list shuffles list in-place

returns: nothing

xgcd

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

disjointCycles

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

cyclesToTranspositions

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

cycleOrder

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

isEven

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

modChecker

checkCycles

checkListOfTranspositions