These procedures were used to create a Maple input file to to read into future worksheets.
The procedures are used to generate the Cayley table for an Alexander quandle. No primality testing is performed. These procedures may produce output for the non prime case; however
 

the Cayley table may be incorrect. Therefore, use only prime modulus.

7/29/05
 

> restart;
 

> AlexQuandle:=proc(polym,prim)
#Input:   (1) A polynomial in t from the Alexander quandle Z_prim[t^-1,t]/(polym)
#         (2) A prime number prim is from the above Alexander Quandle.
#Output:  The output is a two dimensional zero indexed array representing
#         the Cayley table for the Alexander quandle. The elements of the
#         Cayley table are in the set {0..n} where n is the order of the quandle.
#Example input:   AlexQuandle(t+1,3);

option remember;
local i,j,temp,Quandle,f,rrespol;
rrespol:=rres(polym,prim);
Quandle:=array(0..nops(rrespol)-1,0..nops(rrespol)-1);
for i from 1 to nops(rrespol) do
 for j from 1 to nops(rrespol) do
   f:=Alexmult(rrespol[i],rrespol[j],polym,prim);
  temp:=findelt(rrespol,f);
   #Quandle[i-1,j-1]:=f;#comment out above and below lines for elmts in poly form  
 Quandle[i-1,j-1]:=temp-1;
 od;
od;
Quandle;
end:
 

> findelt:=proc(L,pol)
#Input: (1) A list that contains the reduced residues of the Alexander
#           quandle in polynomial(in t) form. This list is generated from
#           the procedure rres().
#       (2) A polynomial from the list L.
#Output: This procedure is used to map the Alexander quandle whose
#        elements are in polynomial form to the set {0..n} where n is the
#        order of the quandle. This procedure returns the position that
#        pol occupies in the list L.
#Exapmle Input: findelt(rres(t+1,3),2);
local i;
for i from 1 to nops(L) do
 if L[i]=pol then return(i);fi;
od;
printf("%s", "ERROR in Procedure findelt");
end:
 

> rres:=proc(polym,m)
#Input:  (1) A polynomial in t from Z_m[t^-1,t]/(polym).
#        (2) The modulus, m, from above.
#Output:  A list containing the reduced residues from Z_m[t^-1,t]/(polym).
#Example Input:  rres(t+1,3);


local L,i,num,deg,C,prep,j,Cof,temp;
Cof:=[];
L:=[];
if type(polym,polynom) then  
  deg:=degree(polym,t);
else
  printf("%s\n",ERROR);
  return;
fi;
Cof:=PolynomialTools[CoefficientList](polym,t);
temp:=1;
   while Cof[temp]=0 do
     temp:=temp+1;
   od;
if gcd(Cof[temp],m)=1 and gcd(Cof[nops(Cof)],m)=1 then
 continue;
else
 printf("%s","ERROR, Not a finite ring.");
 return;
fi;
num:=m^deg;
for i from 0 to num-1 do
 C:=convert(i,base,m);
 if C=[] then prep:=0;
 else
    prep:=0;
    for j from nops(C) to 1 by -1 do  
       prep:=prep+C[j]*t^(j-1);
    od;
 fi;
L:=[op(L),prep];
od;
return(L);
end:   
  
 

> Alexmult:=proc(a,b,polym,m)
#Input:  (1) a is a polynomial in t from the Alexander quandle
#            that will be multiplied by b using the defind Alexander multiplication.
#        (2) b is a polynomial in t from the Alexander quandle that
#            will multiply a using the defined Alexander multiplication.
#        (3) The polynomial polym is a polynomial in t from the Alexander
#            quandleZ_m[t^-1,t]/(polym).
#        (4) The modulus m from the Alexander quandle Z_m[t^-1,t]/(polym).
#Output: A polynomial in t that results after the Alexander multiplication
#        defined as t*a+(1-t)*b is reduced in Z_m[t^-1,t]/(polym).
#Note: Rem says it needs a prime modulus,
#      but also Maple says it will work for any finite field (??)
#Example Input: Alexmult(t+1,2*t-1,t^2-t+1,3);

local i,j,f;
f:=Rem(t*a+(1-t)*b,polym,t) mod m;
end:
 

> quandlesize:=proc(Quandle)
#Procedure to determine how many elements are in the quandle
#Input: A zero indexed two dimensional array representing the
#       the multiplication table for the quandle.
#Output: A positive integer. Representing the number of elements in the set.
local T;
option remember; #create table to avoid multiple function calls
T:=convert(Quandle,matrix);
if linalg[rowdim](T)<>linalg[coldim](T) then
  prinf("%s %s %s\n",ERROR, quandle, dimensions);
else return(linalg[rowdim](T));
fi;
end:
 

> save quandlesize,Alexmult,rres,findelt,AlexQuandle, "J:\\SaitoGood_7_22_05\\alexQuanpkg.m";
 

> ?save
 

>