Help:=proc(): print(`fix(pi), AvF(G) , kefel(pi,sig) , GenG(S) `): print(`Tr(n,i) `): end: #fix(pi): inputs a permutation pi and outputs the #number of fixed points fix:=proc(pi) local n,i,co: n:=nops(pi): co:=0: for i from 1 to n do if pi[i]=i then co:=co+1: fi: od: co: end: with(combinat): #the average number of fixed points of G AvF:=proc(G) local co,pi: add(fix(pi),pi in G)/nops(G): end: #kefel(pi,sig): pi times sig (as perms) kefel:=proc(pi,sig) local i,n: n:=nops(pi): if nops(sig)<>n then RETURN(FAIL): fi: [ seq( sig[pi[i]],i=1..n)]: end: #GenG(S):Given a set if permutations S all of the #same size, outputs the group of permutations #generated by them GenG:=proc(S) local G,NewGuys,pi,sig: if nops({seq(nops(pi),pi in S)})<>1 then RETURN(FAIL): fi: G:=S: NewGuys:= {seq(seq(kefel(pi,sig) , pi in G), sig in S)} minus G: while NewGuys<>{} do G:=G union NewGuys: NewGuys:= {seq(seq(kefel(pi,sig) , pi in G), sig in S)} minus G: od: G: end: #Tr(n,i): the permutation that trasposes i and i+1 (and nothing else #gets changed) Tr:=proc(n,i) local j: if i>=n then RETURN(FAIL): fi: [seq(j,j=1..i-1),i+1,i,seq(j,j=i+2..n)]: end: #SymC3(): the symmetry group of a 3D cube #with the convention that the top is 1, #the bottom is 2, the left wall is 3, the #the right wall is 5, the front wall is 4 #and the back wall is 6 SymC3:=proc() local pi,sig: pi:=[1,2,6,3,4,5]: end: