(* :Title: CycleIndices *) (* :Context: `CycleIndices` *) (* :Author: Eugene Curtin, Southwest Texas State University. ec01@swt.edu *) (* :Copyright: © 1999 by Eugene Curtin *) (* :Summary: This package contains functions which compute the cycle indices of common permutation groups. Functions are included for computing common operations on cycle-indices and on monomials representing permutations. *) (* :Package Version: 1.0 *) (* :Mathematica Version: 3.0 (The package may work with earlier versions, but this has not been tested by the author.) *) (* :Keywords: Cycle Index, Enumeration, Combinatorics, Group Theory, Permutation Groups, Polya Theory *) (* :Sources: [HP] Graphical Enumeration, by E. Palmer and F. Harary, Academic Press 1973 *) (* :Discussion: If a group finite group G acts on a finite set S, we associate to each element g of G a monomial m(g)=x[1]^i_1 x[2]^i_2... where g has i_k orbits with k elements. Summing the monomials over G and dividing by |G| yields the cycle index Z(G) of the action of G on S. Many combinatorial questions can be answered by making substitutions into Z(G). For example setting each x[i]=1 yields the number of orbits of G. Setting x[i]=(1+x^i) yields a polynomial such that the coefficient of x^k will be the number of G-inequivalent k-subsets of S. See Polya's Enumeration Theorem. (HP p42) *) BeginPackage["`CycleIndices`"] Monomials::usage = " Monomials[n,x] (n a positive integer) returns list of monomials of cycle types of permutations in symmetric group on n symbols. Each monomial corresponds to a partition of n." EvenMonomials::usage = "EvenMonomials[n,x] (n a positive integer) returns list of monomials of cycle types of permutations in the alternating group on n symbols." IdentityIndex::usage = "IdentityIndex[n,x] (n a positive integer), returns the cycle index of the trivial group acting on a set of n elements." CyclicIndex::usage = "CyclicIndex[n,x] (n a positive integer), returns the cycle index of the cyclic group of order n acting on a set of n elements in the usual manner." FlipIndex::usage = "FlipIndex[n,x] (n a positive integer), returns the cycle index of the set of permutation which reverse the cyclic order of n elements. If n=1 or n=2 then FlipIndex and CyclicIndex are the same. If n>=3 FlipIndex gives the cycle index of the reflection elements of the dihedral group." DihedralIndex::usage = "DihedralIndex[n,x] (n a positive integer), returns the cycle index of the dihedral group of order 2n acting on a set of n elements in the usual manner." SymmetricIndex::usage = "SymmetricIndex[n,x] (n a positive integer), returns the cycle index of the symmetric group on n symbols." AlternatingIndex::usage = "AlternatingIndex[n,x] (n a positive integer), returns the cycle index of the alternating group on n symbols." WreathProductIndex::usage = "WreathProductIndex[ZP,ZQ,x] returns the cycle index of the wreath product of P with Q, if ZP and ZQ are the cycle indices of permutation groups P and Q. (HP p97. In HP wreath product is refered to as composition)." CentralizerIndex::usage = "CentralizerIndex[monomial,x] returns the cycle index of the centralizer in Sn of an element whose cycle type is given by monomial." InverterIndex::usage = "InverterIndex[monomial,x] returns the cycle index of the set of elements in Sn mapping an element whose cycle type is given by monomial to its inverse under conjugation." PseudoCentralizerIndex::usage = "PseudoCentralizerIndex[monomial,x] returns the cycle index of the set of elements in Sn mapping an element whose cycle type is given by monomial to itself or its inverse under conjugation." CupProduct::usage = "CupProduct[ZP,ZQ,..,x] computes the cup product of arbitrarily many cycle-indices ZP, ZQ... of permutation groups of the same degree." CapProduct::usage = "CapProduct[ZP,ZQ,...,x] computes the cap product of arbitrarily many cycle-indices ZP, ZQ... of permutation groups of the same degree." PalmerJIndex::usage = "PalmerJIndex[ZP,ZQ,x] substitutes the J-0perator J_i^k for each x[i]^k in the cycle-index polynomial ZP and applies the resulting operator to ZQ." PairIndex::usage = "PairIndex[ZP,x] computes the cycle index of P on the set of two-sets, given the cycle index ZP of P on the set of points." MoebiusInvert::usage = "MoebiusInvert[f] computes the Moebius inverse of the integer function f." CrossProductIndex::usage = "CrossProductIndex[ZA,ZB,x] returns the cycle index of the action of AxB on XxY given the indices ZA and ZB of A and B on X and Y, in variable x." SumIndex::usage = "SumIndex[ZA,ZB,x] returns the cycle index of the action of AxB on (X union Y) given the indices ZA and ZB of A and B on X and Y, in variable x." PowerIndex::usage = "PowerIndex[ZA,ZB,x] gives the cycle index of B^A, the group action of AxB on Y^X, the functions X->Y, where ZA is the cycle index of the action of A on X and ZB is the index of theaction of B on Y, using variable x." WreathPowerIndex::usage = "WreathPowerIndex[ZA,ZB,x] gives the cycle index of the group action of the wreath product A[B] on Y^X, the functions X->Y, where ZA is the cycle index of the action of A on X and ZB is the index of theaction of B on Y, using variable x." SignPermutation::usage = "SignPermutation[u,x] gives the sign of a permutation with monomial u in variable x." SymmetricCoefficient::usage = "SymmetricCoefficient[u,x] determines the size of the centralizer of permutation with monomial u in variable x. Equivalently it gives the number of ways to write down the cycle decomposition of the permutation." SetDegree::usage = "SetDegree[u,x] determines the degree of the permutation group of the permutation with monomial u in variable x." EvenPermutationQ::usage = "EvenPermutationQ[u,x] returns True if u is the monomial in x of an even permutation." MonomialQ::usage = "MonomialQ[u,x] determines whether u is a cycle index monomial in x." IndexPolynomialQ::usage = "IndexPolynomialQ[u,x] performs a rudimentary check to determine whether u appears to be a cycle index polynomial in x. It does not check that the monomials in u represent permutations of the same degree." CycleMultiplicity::usage = "CycleMultiplicity[u,k,x] returns the number of k-cycles of permutation with monomial u in x." MonomialPower::usage = "MonomialPower[u,k,x] returns the monomial for the k-th power of a permutation with monomial u in x." ElementOrder::usage = "ElementOrder[u,x] returns the order of a permutation with monomial u in x." KthIndex::usage = "KthIndex[A,x,k] replaces each instance of x[i] by x[i k] in the cycle index polynomial A." ConjugationIndex::usage = "ConjugationIndex[ZA,S,x] returns the cycle index of the action of A, a subgroup of Sn, on the set of permutations in Sn with cycle types of the monomials from the set s with variable x, given the cycle index ZA of A" MultiConjugationIndex::usage = "MultiConjugationIndex[ZA,S,x] returns the cyclemultivariable index of the action of A, a subgroup of Sn, on the set of permutations in Sn with cycle types of the monomials from the set s with variable x, given the cycle index ZA of A. In the output x[i,j]^k denotes the product of k j-cycles in on the permutations of the i-th cycle type from S." SkewConjugationIndex::usage = "SkewConjugationIndex[ZA,S,x] returns the cycle index of the action of A, a subgroup of Sn, on the set of permutations in Sn/~ with cycle types of the monomials from the set s with variable x, given the cycle index ZA of A, where ~ denotes the identification of each permutation with its inverse." MultiSkewConjugationIndex::usage = "MultiSkewConjugationIndex[ZA,S,x] returns the cycle index of the action of A, a subgroup of Sn, on the set of permutations in Sn/~ with cycle types of the monomials from the set s with variable x, given the cycle index ZA of A, where ~ denotes the identification of each permutation with its inverse. In the output x[i,j]^k denotes the product of k j-cycles in on the permutations of the i-th cycle type from S." Begin["`Private`"] (*--------------------------Tests------------------------*) PositiveIntegerQ[n_]:=IntegerQ[n] && (n>0); EvenPermutationQ[u_,x_]:=(SignPermutation[u,x]==1); IndexPolynomialQ[A_,x_]:=PolynomialQ[A] && (A /. {x[i_]->0})===0; MonomialQ[x_[i_],x_]:=True; MonomialQ[x_[i_]^j_,x_]:=True; MonomialQ[u_ v_,x_]:=MonomialQ[u,x] && MonomialQ[v,x]; MonomialQ[y_,x_]:=False; (*------------------Generation of Monomials---------------*) Monomials[n_?IntegerQ,x_]:= Module[{KPartMonomials}, KPartMonomials[m_,0]:={}; KPartMonomials[m_,1]:={x[1]^m}; KPartMonomials[0,k_]:={1}; KPartMonomials[m_,k_]:={} /; (m<0); KPartMonomials[m_,k_]:=Join[Times[#,x[k]]& /@ KPartMonomials[m-k,k], KPartMonomials[m,k-1]]; If[n>=1,KPartMonomials[n,n],{}]]; Monomials[a_,x_]:={}; EvenMonomials[n_?IntegerQ,x_]:= Select[Monomials[n,x],EvenPermutationQ[#,x]&]; (*------------------Functions on Monomials---------------*) SignPermutation[x_[i_],x_]:=(-1)^(i+1); SignPermutation[x_[i_]^j_,x_]:=(-1)^(i j + j); SignPermutation[u_ v_,x_]:=SignPermutation[u,x] SignPermutation[v,x]; SymmetricCoefficient[x_[i_],x_]:=i; SymmetricCoefficient[x_[i_]^k_,x_]:=i^k k!; SymmetricCoefficient[u_ v_,x_]:= SymmetricCoefficient[u,x]*SymmetricCoefficient[v,x]; CycleMultiplicity[x_[i_],k_,x_]:=If[i==k,1,0]; CycleMultiplicity[x_[i_]^j_,k_,x_]:=If[i==k,j,0]; CycleMultiplicity[u_ v_,k_,x_]:= CycleMultiplicity[u,k,x] + CycleMultiplicity[v,k,x]; SetDegree[x_[i_],x_]:=i; SetDegree[x_[i_]^k_,x_]:=i k; SetDegree[u_ v_,x_]:=SetDegree[u,x] +SetDegree[v,x]; SetDegree[u_+v_,x_]:=If[SetDegree[u,x]==SetDegree[v,x],SetDegree[u,x],0]; SetDegree[a_?NumberQ u_,x_]:=SetDegree[u,x]; MonomialPower[x_[i_],k_,x_]:=x[i/GCD[i,k]]^GCD[i,k]; MonomialPower[x_[i_]^j_,k_,x_]:=x[i/GCD[i,k]]^(j GCD[i,k]); MonomialPower[u_ v_,k_,x_]:=MonomialPower[u,k,x] MonomialPower[v,k,x]; ElementOrder[x_[i_],x_]:=i; ElementOrder[x_[i_]^j_,x_]:=i; ElementOrder[u_ v_,x_]:=LCM[ElementOrder[u,x],ElementOrder[v,x]]; (*-----------------Standard Moebius Inversion-----------*) MoebiusInvert[f_]:= ((f /@ Divisors[#]) . (MoebiusMu /@ Reverse[Divisors[#]]))&; (*------------- Cycle Indices of Common Groups ---------------*) IdentityIndex[n_?PositiveIntegerQ,x_]:=x[1]^n; CyclicIndex[n_?PositiveIntegerQ,x_]:= Expand[(1/n) (Sum[ If[Mod[n,k]==0, If[k==1,1,EulerPhi[k]] x[k]^(n/k),0],{k,1,n}])]; (* Some Mathematica versions have EulerPhi[1]=0, we ensure the value 1 with the If *) FlipIndex[n_?PositiveIntegerQ,x_]:= Expand[ If[EvenQ[n],1/2 (x[2]^(n/2) + x[1]^2 x[2]^((n-2)/2)), (x[1] x[2]^((n-1)/2))]]; DihedralIndex[n_?PositiveIntegerQ,x_]:= Expand[1/2 (CyclicIndex[n,x]+ FlipIndex[n,x])]; SymmetricIndex[n_?PositiveIntegerQ,x_]:= Plus @@(((1/SymmetricCoefficient[#,x]) #)& /@ Monomials[n,x]); AlternatingIndex[n_?PositiveIntegerQ,x_]:= Plus @@(((2/SymmetricCoefficient[#,x]) #)& /@ EvenMonomials[n,x]); CentralizerIndex[x_[i_],x_]:=CyclicIndex[i,x]; CentralizerIndex[x_[i_]^j_,x_]:= WreathProductIndex[SymmetricIndex[j,x],CyclicIndex[i,x],x]; CentralizerIndex[u_ v_,x_]:=Expand[CentralizerIndex[u,x] CentralizerIndex[v, x]]; InverterIndex[x_[i_],x_]:=FlipIndex[i,x]; InverterIndex[x_[i_]^j_,x_]:=Expand[SymmetricIndex[j,x] /. {x[r_?OddQ]->KthIndex[FlipIndex[i,x],x,r], x[r_?EvenQ]->KthIndex[CyclicIndex[i,x],x,r]}]; InverterIndex[u_ v_,x_]:=Expand[InverterIndex[u,x] InverterIndex[v,x]]; PseudoCentralizerIndex[u_,x_]:=Expand[ 1/2 (CentralizerIndex[u,x]+ InverterIndex[u,x])]; (*-------------Unary Functions on Cycle Indices-------------*) KthIndex[G_,x_,k_]:= (G /. {x[i_]:>x[i k]}) /; IndexPolynomialQ[G,x]; PairIndex[M_,x_]:= Module[{f1,f2,f3,PairCycles}, f1[x[i1_]^(j1_)] := 1; f1[x[i1_]] := 1; f1[x[i1_]*x[(i2_)^(j2_)]] := x[LCM[i1, i2]]^(j2*GCD[i1, i2]); f1[x[i1_]^(j1_)*x[i2_]] := x[LCM[i1, i2]]^(j1*GCD[i1, i2]); f1[x[i1_]*x[i2_]] := x[LCM[i1, i2]]^GCD[i1, i2]; f1[x[i1_]^(j1_)*x[i2_]^(j2_)] := x[LCM[i1, i2]]^(j1*j2*GCD[i1, i2]); f1[(a_)*(t__)] := Product[f1[a*{t}[[i]]], {i, Length[{t}]}]* f1[Times @@ {t}]; (* counts cycles for pairs {x,y} lying in cycles of different length *) f2[x[i1_]^j1_]:=x[i1]^(i1 Binomial[j1,2]); f2[x[i1_]]:=1; f2[a_ b_ ]:=f2[a] f2[b]; (* counts cycles for pairs {x,y} with x and y lying in different cycles of the same length *) f3[x[i1_]]:=If[OddQ[i1],x[i1]^( (i1-1)/2), x[i1]^( (i1-2)/2) * x[i1/2]]; f3[x[i1_]^j1_]:=If[OddQ[i1],x[i1]^(j1 (i1-1)/2), x[i1]^(j1 (i1-2)/2) * x[i1/2]^j1]; f3[a_ b_]:=f3[a] f3[b]; (* counts cycles for pairs {x,y} with x and y lying in the same cycle *) PairCycles[u_ + v_]:=PairCycles[u]+ PairCycles[v]; PairCycles[a_?NumberQ b_]:=a PairCycles[b]; PairCycles[a_]:=f1[a] f2[a] f3[a]; Expand[PairCycles[M]]] /; IndexPolynomialQ[M,x]; (*---Functions of two or more cycle indices returning a cycle index---*) WreathProductIndex[A_,B_,x_]:=(Expand[A /. x[k_]:>KthIndex[B,x,k]]) /; IndexPolynomialQ[A,x] && IndexPolynomialQ[B,x]; CupProduct[r__,x_]:=(Module[{cp}, cp[u]:=Expand[u]; cp[u_,v_]:= If[u===v,SymmetricCoefficient[u,x] u,0]/;MonomialQ[u,x] && MonomialQ[v,x]; cp[a_?NumberQ u_,v_]:=a cp[u,v]; cp[u_,a_?NumberQ v_]:=a cp[u,v]; cp[u1_ + u2_,v_]:=cp[u1,v] + cp[u2,v]; cp[u_,v1_ + v2_]:=cp[u,v1]+cp[u,v2]; cp[0,v_]:=0; cp[u_,0]:=0; cp[u__,v_]:=cp[cp[u],v]; Expand[cp[r]]]) /; Apply[And,IndexPolynomialQ[#,x]& /@ {r}]; PalmerJIndex[A_,B_,x_]:=(Module[ {J,d}, d[i_,r_,k_]:= If[Mod[r,i]==0 && GCD[r/i,k]==1,x[k i]/k,0]; (* this is the d-function of p169 HP *) J[a_?NumberQ ,x[r_]]:=a; J[u_ v_,x[r_]]:=Expand[J[u,x[r]] J[v,x[r]]]; J[u_,a_?NumberQ v_]:=Expand[a J[u,v]]; J[u_ +v_,x[r_]]:=Expand[J[u,x[r]] + J[v,x[r]]]; J[u_,v_ + w_]:=Expand[J[u,v]+J[u,w]]; J[u_,x[r_]^k_]:=CupProduct[J[u,x[r]^(k-1)], J[u,x[r]],x]; J[u_,v_ w_]:=Expand[CupProduct[J[u,v],J[u,w],x]];J[x[k_],x[r_]]:=k d[1,r,k]; J[x[k_]^j_,x[r_]]:=Expand[k^j j! SymmetricIndex[j,x]/. {x[t_]->d[t,r,k]}]; (* J_r(x[k]) and J_r (x[k]^j)*) J[A,B]]) /; IndexPolynomialQ[A,x] && IndexPolynomialQ[B,x]; PowerIndex[u_,v_,x_]:=(Module[{pgi,jpower}, jpower[a_,b_,1]:=Product[ If[CycleMultiplicity[a,k,x]==0,1, Apply[Plus, ((#) CycleMultiplicity[b,#,x])& /@ Divisors[k]]^CycleMultiplicity[a,k,x]] ,{k,SetDegree[a,x]}]; jpower[a_,b_,k_]:=1/k * MoebiusInvert[jpower[MonomialPower[a,#,x], MonomialPower[b,#,x],1]&][k]; pgi[a_,b_]:=Product[x[k]^jpower[a,b,k],{k,SetDegree[b,x]^SetDegree[a,x]}]; pgi[c_?NumberQ a_,b_]:=c pgi[a,b]; pgi[a_,c_?NumberQ b_]:=c pgi[a,b]; pgi[a1_ + a2_,b_]:= pgi[a1,b]+ pgi[a2,b]; pgi[a_,b1_+b2_]:= pgi[a,b1]+ pgi[a,b2]; Expand[pgi[u,v]]]) /; IndexPolynomialQ[u,x] && IndexPolynomialQ[v,x]; SumIndex[a_,b_,x_]:=Expand[a b]; CrossProductIndex[a_,b_,x_]:=(Module[{cross}, cross[x[i_],x[j_]]:=x[LCM[i,j]]^GCD[i,j]; cross[x[i_]^r_,x[j_]]:=x[LCM[i,j]]^(r GCD[i,j]); cross[x[i_],x[j_]^s_]:=x[LCM[i,j]]^(s GCD[i,j]); cross[x[i_]^r_,x[j_]^s_]:=x[LCM[i,j]]^(r s GCD[i,j]); (* definition of cross for simple monomials *) cross[u_ v_,w_]:= cross[u,w] *cross[v,w]/;MonomialQ[w,x] && MonomialQ[u v,x]; cross[u_,v_ w_]:=cross[u,v] *cross[u,w]/;MonomialQ[u,x]&& MonomialQ[v w,x]; (* extension of cross to compound monomials *) cross[u1_ +u2_,v_]:=cross[u1,v] + cross[u2,v]; cross[u_,v1_+v2_]:=cross[u,v1]+cross[u,v2]; cross[c_?NumberQ u_,v_]:=c cross[u,v]; cross[u_,c_?NumberQ v_]:=c cross[u,v]; (* extension of cross to polynomials *) Expand[cross[a,b]]]) /; IndexPolynomialQ[a,x] && IndexPolynomialQ[b,x]; WreathPowerIndex[a_,b_,x_]:= (Module[ {wprod,wcycles,wexponent}, wcycles[x[r_],v_,k_]:= (Apply[Plus, ((#) CycleMultiplicity[v,#,x])& /@ Divisors[k/GCD[r,k]]])^GCD[r,k]; wexponent[x[r_],v_,k_]:=1/k * MoebiusInvert[wcycles[x[r],v,#]&][k]; wprod[x[r_],v_]:=Product[x[k]^wexponent[x[r],v,k],{k,SetDegree[v,x]^r}] /;MonomialQ[v,x]; (* *) wprod[x[r_],v1_+v2_]:=wprod[x[r],v1] +wprod[x[r],v2]; wprod[x[r_],c_?NumberQ v_]:=c wprod[x[r],v]; (* linearity extension to *) wprod[c_?NumberQ u_,v_]:=c wprod[u,v]; wprod[u1_ +u2_,v_]:= wprod[u1,v] + wprod[u2,v]; (* extension from to *) wprod[x[r_]^j_,v_]:= CrossProductIndex[wprod[x[r]^(j-Floor[j/2]),v], wprod[x[r]^Floor[j/2],v],x]; wprod[u1_ u2_,v_]:=CrossProductIndex[wprod[u1,v],wprod[u2,v],x]; (* reduction of wprods to CrossProduct *) Expand[wprod[a,b]]]) /; IndexPolynomialQ[a,x] && IndexPolynomialQ[b,x]; (* --------Integer Valued Functions of Cycle Indices-------*) CapProduct[u__,x_]:=(CupProduct[u,x] /. {x[i_]->1}) /; Apply[And,IndexPolynomialQ[#,x]& /@ {u}]; (*-----Functions taking a cycle index and monomial set and returning a cycle index of a conjugacy type action-----------------*) ConjugationIndex[a_,b_,x_]:= (Module[{kfixed,kcycles,ci,bpoly,z}, bpoly[i_]:=bpoly[i]=CentralizerIndex[b[[i]],x]; kfixed[u_,k_]:=Apply[Plus,(SymmetricCoefficient[MonomialPower[u,k,x],x]* Coefficient[bpoly[#]+z,MonomialPower[u,k,x]])& /@ Range[Length[b]]] ; (* counts the number of permutations of type b fixed under conjugation by u^k. A bug in the coefficient function in some Mathematica versions occasionally led to incorrect results here without the use of the dummy z variable. *) kcycles[u_,k_]:=(1/k) MoebiusInvert[kfixed[u,#]&][k]; ci[u_]:=Apply[Times,(x[#]^kcycles[u,#])& /@ Divisors[ElementOrder[u,x]]] /;MonomialQ[u,x]; ci[c_?NumberQ u_]:=c ci[u]; ci[u1_ + u2_]:=ci[u1] + ci[u2]; ci[a]]) /; IndexPolynomialQ[a,x] && Apply[And,MonomialQ[#,x]& /@ b]; MultiConjugationIndex[a_,b_,x_]:= (Module[{kfixed,kcycles,ci,z,bpoly}, bpoly[i_]:=bpoly[i]=CentralizerIndex[b[[i]],x]; kfixed[u_,k_,i_]:=SymmetricCoefficient[MonomialPower[u,k,x],x]* Coefficient[bpoly[i]+z,MonomialPower[u,k,x]]; (* counts the number of permutations of type b[[i]] fixed under conjugation by u^k. *) kcycles[u_,k_,i_]:=(1/k) MoebiusInvert[kfixed[u,#,i]&][k]; ci[u_,i_]:= Apply[Times,(x[i,#]^kcycles[u,#,i])& /@ Divisors[ElementOrder[u,x]]] /;MonomialQ[u,x]; ci[u_]:=Apply[Times,ci[u,#]& /@ Range[Length[b]]]; ci[c_?NumberQ u_]:=c ci[u]; ci[u1_ + u2_]:=ci[u1] + ci[u2]; ci[a]]) /; IndexPolynomialQ[a,x] && Apply[And,MonomialQ[#,x]& /@ b]; SkewConjugationIndex[a_,b_,x_]:= (Module[{kfixed,kcycles,ci,bpoly,z}, bpoly[i_]:=bpoly[i]=PseudoCentralizerIndex[b[[i]],x]; kfixed[u_,k_]:=Apply[Plus,(SymmetricCoefficient[MonomialPower[u,k,x],x]* Coefficient[bpoly[#]+z,MonomialPower[u,k,x]])& /@ Range[Length[b]]] ; (* counts the number of permutations of type b fixed under conjugation by u^k. *) kcycles[u_,k_]:=(1/k) MoebiusInvert[kfixed[u,#]&][k]; ci[u_]:=Apply[Times,(x[#]^kcycles[u,#])& /@ Divisors[ElementOrder[u,x]]] /;MonomialQ[u,x]; ci[c_?NumberQ u_]:=c ci[u]; ci[u1_ + u2_]:=ci[u1] + ci[u2]; ci[a]]) /; IndexPolynomialQ[a,x] && Apply[And,MonomialQ[#,x]& /@ b]; MultiSkewConjugationIndex[a_,b_,x_]:= (Module[{kfixed,kcycles,ci,z,bpoly}, bpoly[i_]:=bpoly[i]=PseudoCentralizerIndex[b[[i]],x]; kfixed[u_,k_,i_]:=SymmetricCoefficient[MonomialPower[u,k,x],x]* Coefficient[bpoly[i]+z,MonomialPower[u,k,x]]; (* counts the number of permutations of type b[[i]] fixed under conjugation by u^k. *) kcycles[u_,k_,i_]:=(1/k) MoebiusInvert[kfixed[u,#,i]&][k]; ci[u_,i_]:= Apply[Times,(x[i,#]^kcycles[u,#,i])& /@ Divisors[ElementOrder[u,x]]] /;MonomialQ[u,x]; ci[u_]:=Apply[Times,ci[u,#]& /@ Range[Length[b]]]; ci[c_?NumberQ u_]:=c ci[u]; ci[u1_ + u2_]:=ci[u1] + ci[u2]; ci[a]]) /; IndexPolynomialQ[a,x] && Apply[And,MonomialQ[#,x]& /@ b]; End[ ] Protect[AlternatingIndex,CapProduct,CentralizerIndex, ConjugationIndex,CrossProductIndex, CupProduct,CycleMultiplicity,CyclicIndex, DihedralIndex,ElementOrder,EvenMonomials, EvenPermutationQ,FlipIndex,IdentityIndex, IndexPolynomialQ,InverterIndex,KthIndex,MoebiusInvert ,MonomialPower,MonomialQ,Monomials,MultiConjugationIndex, MultiSkewConjugationIndex,PairIndex,PalmerJIndex, PowerIndex,PseudoCentralizerIndex,SetDegree, SignPermutation,SkewConjugationIndex,SumIndex, SymmetricCoefficient,SymmetricIndex,WreathPowerIndex, WreathProductIndex] EndPackage[ ]