I wish GAP had decent support for polynomials...... This is a bit clunky because I have to use x_1000 for the final variable to sub into the expression...
cycleIndex computes the cycle index... say zg = cycleIndex(g); Then do Value(zg, nvars(deg), xvals(deg)) to substitute in the usual "1+x, 1+x^2, 1+x^3 ... " etc... where "deg" is the degree of the group. ############################################################################### # # Calculates the cycle index of a group directly from the conjugacy classes # cycleIndex := function(g) local cl,cs,x,px,term,zg,deg,i; zg := 0; deg := NrMovedPoints(g); cl := ConjugacyClasses(g); for x in cl do px := Representative(x); cs := CycleStructurePerm(px); term := Size(x) * Indeterminate(Rationals,1) ^ (deg - NrMovedPoints(px)); #Print(cs,"-"); for i in [1..deg] do if (IsBound(cs[i])) then term := term * Indeterminate(Rationals,i+1)^cs[i]; fi; od; #Print(term,"\n"); zg := zg + term; od; return zg/Order(g); end; ############################################################################ # Returns a list of the first n indeterminates to sub into the cycle index nvars := function(n) local i, vars; vars := []; for i in [1..n] do Add(vars,Indeterminate(Rationals,i)); od; return vars; end; ############################################################################ # Returns a list of length n, with entries equal to 1+x, 1+x^2 and so on xvals := function(n) local i, vals, x; x := Indeterminate(Rationals,1000); Print(IndeterminateNumberOfLaurentPolynomial(x),"\n"); vals := []; for i in [1..n] do Add(vals,1+x^i); od; return vals; end; On 19/12/2010, at 8:22 PM, Hebert Pérez-Rosés wrote: > Dear all, > > Does anybody have a GAP function to compute the cycle index of a permutation > group, and perform Polya enumeration? > > Best regards, > > Hebert Perez-Roses > The University of Newcastle, Australia > _______________________________________________ > Forum mailing list > Forum@mail.gap-system.org > http://mail.gap-system.org/mailman/listinfo/forum > _______________________________________________ Forum mailing list Forum@mail.gap-system.org http://mail.gap-system.org/mailman/listinfo/forum