Help:=proc(): print(`fix(pi), AvF(G) , kefel(pi,sig) , GenG(S) `): print(`Tr(n,i) , Cyc(pi), NumCol(G,c), CubeGp(), Wt(pi,x),WtCol(G,c,x) `): print(`Ind(pi) , UnLG(n)`): 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: #Cyc(pi): inputs a perm. pi and a member i #and outputs its cycle Cyc:=proc(pi) local tem,Lone,n: n:=nops(pi): tem:=convert(pi,disjcyc): Lone:={seq(i,i=1..n)} minus {seq(op(c),c in tem)}: tem:={op(tem)} union {seq([i], i in Lone)}: end: #NumCol(G,c): The number of inequivalent colorings of #some set A (not mentioned) whose "symmetry group" is #G (given as a set of permutations of [1, ,,,, n] where #n=nops(A) NumCol:=proc(G,c) local pi: add(c^nops(Cyc(pi)), pi in G)/nops(G): end: #CubeGp(): The symmetry cube of the faces of the 3D unit cube CubeGp:=proc(): GenG({[1,2,5,6,4,3], [5,6,3,4,2,1]}): end: #Wt(pi,x,c): the comtribution to the weight-enumerator of a single perm #pi with x colors using x[1], ..., x[c Wt:=proc(pi,x,c) local beth,b: beth:=Cyc(pi): mul( add(x[i]^nops(b), i=1..c), b in beth): end: #WtCol(G,c,x): The weight-enumerator of inequivalent colorings of #some set A (not mentioned) whose "symmetry group" is #G (given as a set of permutations of [1, ,,,, n] where #n=nops(A) according to the weight #x[1]^(number of membres of A colored with color1) x #x[2]^(" color 2)x #.... WtCol:=proc(G,c,x) local pi: add( Wt(pi,x,c) , pi in G)/nops(G): end: #Ind(pi): the induced permutation on the set of #edges of {1, ...,n} (n=nops(pi)) Ind:=proc(pi) local n,T,i,j, Edg,N1,N2,co: n:=nops(pi): Edg:={}: co:=0: for i from 1 to n do for j from i+1 to n do T[{i,j}]:={ pi[i],pi[j]}: co:=co+1: N1[{i,j}]:=co: N2[co]:={i,j}: od: od: [ seq(N1[T[N2[i]]],i=1..binomial(n,2)) ]: end: #the number of unlabelled graphs on n vertices UnLG:=proc(n) local G: G:={seq(Ind(pi), pi in permute(n))}: NumCol(G,2): end: