Skip to content

OrbitInventory ​

Pólya's enumeration theorem. The inventory of the colorings a group acts on, up to the group, from a cycle index ZZ and the weights of the colors, each xix_i becoming the power sum pi=∑jwjip_i = \sum_j w_j^i. A single number kk for the weights gives the count of kk-colorings.

✓ checked against that system · ! checked, with disagreements (hover a chip)CombinatoricaOrbitInventory
OrbitInventory(ci, {x1, x2, ...}, {w1, w2, ...})the cycle index ci, in the variables x_i, with each x_i replaced by w1i+w2i+⋯w_1^i + w_2^i + \cdots, expanded. The coefficient of w1a1w2a2⋯w_1^{a_1} w_2^{a_2} \cdots counts the colorings using color jj exactly aja_j times, up to the group
OrbitInventory(ci, {x1, x2, ...}, k)the cycle index ci with every x_i replaced by k, the number of colorings with kk colors up to the group
Typed signatures
TypePackageApplies
(number, list, list | number) -> numbergroupalgebraalways

Domain: Permutations

Details
  • Combinatorica's name and argument order, OrbitInventory[ci, x, w], with the one difference that the second argument is the list of variables the cycle index is written in (what CycleIndexPolynomial was given), since ours has no indexed variable x[i]x[i]
  • With a list of weights the answer is the expanded polynomial; with one number kk it is the cycle index at xi=kx_i = k, which is the same as kk weights of 11. Either way it is Pólya's theorem: the cycle index of the group, with xi→∑jwjix_i \to \sum_j w_j^i
  • The variables must be distinct symbols and the weights a nonempty list or a number, else the call stays unevaluated. A weight may share a name with a variable: the substitution is simultaneous
  • Defined in Epsil as a substitution into the cycle index (the variables renamed apart, then replaced by the power sums and expanded); there is no kernel
  • Every example here was checked against Combinatorica's OrbitInventory[CycleIndex[group, x], x, w] and Sage's cycle_index() with the same substitution. The oracle lane takes no free symbols, so the records hold no scan rows
  • The count of necklaces and bracelets is KNecklaces and KBracelets, whose own counts agree with this one: two colors give OEIS A000031 under CnC_n and A000029 under DnD_n. A group with no named head, like the rotations of a cube, goes through PermutationGroup

Plot

argument p2 of type list has no control

Examples

Basic #

Square necklaces in red and blue: the coefficient of rab4−ar^a b^{4-a} counts those with aa red beads (the two with two red beads are the neighbors and the opposite pair)

live ↗
InOrbitInventory(CycleIndexPolynomial(CyclicGroup(4),[x1,x2,x3,x4]),[x1,x2,x3,x4],[r,b])\mathrm{OrbitInventory}(\mathrm{CycleIndexPolynomial}(\mathrm{CyclicGroup}(4), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}\bigr\rbrack), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}\bigr\rbrack, \bigl\lbrack r, b\bigr\rbrack)Outb4+r4+rb3+br3+2b2r2b^4+{{r}}^4+{{r}}b^3+b{{r}}^3+2b^2{{r}}^2

One number for the weights counts the colorings: 2-colored necklaces of 4 beads, the inventory above at r=b=1r = b = 1

live ↗
InOrbitInventory(CycleIndexPolynomial(CyclicGroup(4),[x1,x2,x3,x4]),[x1,x2,x3,x4],2)\mathrm{OrbitInventory}(\mathrm{CycleIndexPolynomial}(\mathrm{CyclicGroup}(4), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}\bigr\rbrack), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}\bigr\rbrack, 2)Out66
Scope #

Three colors on a triangle: the two orientations of a necklace using all three colors are the same up to rotation, hence the 2

live ↗
InOrbitInventory(CycleIndexPolynomial(CyclicGroup(3),[x1,x2,x3]),[x1,x2,x3],[r,g,b])\mathrm{OrbitInventory}(\mathrm{CycleIndexPolynomial}(\mathrm{CyclicGroup}(3), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}\bigr\rbrack), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}\bigr\rbrack, \bigl\lbrack r, g, b\bigr\rbrack)Outb3+g3+r3+gb2+rb2+bg2+rg2+br2+gr2+2bgrb^3+g^3+{{r}}^3+gb^2+{{r}}b^2+bg^2+{{r}}g^2+b{{r}}^2+g{{r}}^2+2bg{{r}}

Reflections merge some necklaces: with three red beads of six, D6D_6 has 3 bracelets where C6C_6 has 4

live ↗
InOrbitInventory(CycleIndexPolynomial(DihedralGroup(6),[x1,x2,x3,x4,x5,x6]),[x1,x2,x3,x4,x5,x6],[r,b])\mathrm{OrbitInventory}(\mathrm{CycleIndexPolynomial}(\mathrm{DihedralGroup}(6), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}, \mathrm{x6}\bigr\rbrack), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}, \mathrm{x6}\bigr\rbrack, \bigl\lbrack r, b\bigr\rbrack)Outb6+r6+rb5+br5+3r4b2+3b4r2+3b3r3b^6+{{r}}^6+{{r}}b^5+b{{r}}^5+3{{r}}^4b^2+3b^4{{r}}^2+3b^3{{r}}^3

The weights may share names with the variables: 12(p12+p2)\tfrac12(p_1^2 + p_2) with p1=x1+x2p_1 = x_1 + x_2 and p2=x12+x22p_2 = x_1^2 + x_2^2

live ↗
InOrbitInventory(x12+x22,[x1,x2],[x1,x2])\mathrm{OrbitInventory}(\frac{\mathrm{x1}^2+\mathrm{x2}}{2}, \bigl\lbrack\mathrm{x1}, \mathrm{x2}\bigr\rbrack, \bigl\lbrack\mathrm{x1}, \mathrm{x2}\bigr\rbrack)Outx12+x22+x1x2\mathrm{x1}^2+\mathrm{x2}^2+\mathrm{x1}\mathrm{x2}
Applications #

Faces of a cube painted with two colors, up to its 24 rotations (a quarter turn about each of two axes generates them)

live ↗
InOrbitInventory(CycleIndexPolynomial(PermutationGroup([Cycles([[3,6,4,5]]),Cycles([[1,3,2,4]])]),[x1,x2,x3,x4,x5,x6]),[x1,x2,x3,x4,x5,x6],2)\mathrm{OrbitInventory}(\mathrm{CycleIndexPolynomial}(\mathrm{PermutationGroup}(\bigl\lbrack\mathrm{Cycles}(\bigl\lbrack\bigl\lbrack3, 6, 4, 5\bigr\rbrack\bigr\rbrack), \mathrm{Cycles}(\bigl\lbrack\bigl\lbrack1, 3, 2, 4\bigr\rbrack\bigr\rbrack)\bigr\rbrack), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}, \mathrm{x6}\bigr\rbrack), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}, \mathrm{x6}\bigr\rbrack, 2)Out1010

The 10 colorings by number of red faces: one each for 0, 1, 5 and 6 red faces, two each for 2, 3 and 4

live ↗
InOrbitInventory(CycleIndexPolynomial(PermutationGroup([Cycles([[3,6,4,5]]),Cycles([[1,3,2,4]])]),[x1,x2,x3,x4,x5,x6]),[x1,x2,x3,x4,x5,x6],[r,b])\mathrm{OrbitInventory}(\mathrm{CycleIndexPolynomial}(\mathrm{PermutationGroup}(\bigl\lbrack\mathrm{Cycles}(\bigl\lbrack\bigl\lbrack3, 6, 4, 5\bigr\rbrack\bigr\rbrack), \mathrm{Cycles}(\bigl\lbrack\bigl\lbrack1, 3, 2, 4\bigr\rbrack\bigr\rbrack)\bigr\rbrack), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}, \mathrm{x6}\bigr\rbrack), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}, \mathrm{x6}\bigr\rbrack, \bigl\lbrack r, b\bigr\rbrack)Outb6+r6+rb5+br5+2r4b2+2b4r2+2b3r3b^6+{{r}}^6+{{r}}b^5+b{{r}}^5+2{{r}}^4b^2+2b^4{{r}}^2+2b^3{{r}}^3

Pólya's count is the necklace count of KNecklaces

live ↗
InOrbitInventory(CycleIndexPolynomial(CyclicGroup(6),[x1,x2,x3,x4,x5,x6]),[x1,x2,x3,x4,x5,x6],3)=Count(KNecklaces(6,3))\mathrm{OrbitInventory}(\mathrm{CycleIndexPolynomial}(\mathrm{CyclicGroup}(6), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}, \mathrm{x6}\bigr\rbrack), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}, \mathrm{x6}\bigr\rbrack, 3)=\mathrm{Count}(\mathrm{KNecklaces}(6, 3))OutTrue\mathrm{True}

With the reflections, the bracelet count of KBracelets

live ↗
InOrbitInventory(CycleIndexPolynomial(DihedralGroup(7),[x1,x2,x3,x4,x5,x6,x7]),[x1,x2,x3,x4,x5,x6,x7],4)=Count(KBracelets(7,4))\mathrm{OrbitInventory}(\mathrm{CycleIndexPolynomial}(\mathrm{DihedralGroup}(7), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}, \mathrm{x6}, \mathrm{x7}\bigr\rbrack), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}, \mathrm{x6}, \mathrm{x7}\bigr\rbrack, 4)=\mathrm{Count}(\mathrm{KBracelets}(7, 4))OutTrue\mathrm{True}
Properties #

Binary necklaces of length 8, OEIS A000031

live ↗
InOrbitInventory(CycleIndexPolynomial(CyclicGroup(8),[x1,x2,x3,x4,x5,x6,x7,x8]),[x1,x2,x3,x4,x5,x6,x7,x8],2)\mathrm{OrbitInventory}(\mathrm{CycleIndexPolynomial}(\mathrm{CyclicGroup}(8), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}, \mathrm{x6}, \mathrm{x7}, \mathrm{x8}\bigr\rbrack), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}, \mathrm{x6}, \mathrm{x7}, \mathrm{x8}\bigr\rbrack, 2)Out3636

Binary bracelets of length 8, OEIS A000029

live ↗
InOrbitInventory(CycleIndexPolynomial(DihedralGroup(8),[x1,x2,x3,x4,x5,x6,x7,x8]),[x1,x2,x3,x4,x5,x6,x7,x8],2)\mathrm{OrbitInventory}(\mathrm{CycleIndexPolynomial}(\mathrm{DihedralGroup}(8), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}, \mathrm{x6}, \mathrm{x7}, \mathrm{x8}\bigr\rbrack), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}, \mathrm{x6}, \mathrm{x7}, \mathrm{x8}\bigr\rbrack, 2)Out3030

Weights of 1 count colorings: three colors on a pentagon, the same as the number 33 for the weights

live ↗
InOrbitInventory(CycleIndexPolynomial(CyclicGroup(5),[x1,x2,x3,x4,x5]),[x1,x2,x3,x4,x5],[1,1,1])\mathrm{OrbitInventory}(\mathrm{CycleIndexPolynomial}(\mathrm{CyclicGroup}(5), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}\bigr\rbrack), \bigl\lbrack\mathrm{x1}, \mathrm{x2}, \mathrm{x3}, \mathrm{x4}, \mathrm{x5}\bigr\rbrack, \bigl\lbrack1, 1, 1\bigr\rbrack)Out5151
About
Examples12
Checked againstWolfram Language 10 agreeCombinatorica 8 agree2 unevaluatedSageMath 10 agree
CrosswalkCombinatorica ×2SageMath

Implementation

mappedcombinatoricapackages/oracle/src/mappings.ts

our cycle index is in the variables listed, Combinatorica's in x[i], so the template renames them first.

mappedsagepackages/oracle/src/mappings.ts

Sage has no OrbitInventory; its cycle_index() with each x_i replaced by the power sum of the weights (or the number of colors) is the definition.

mappedwolframpackages/oracle/src/mappings.ts

Wolfram has no OrbitInventory (it is Combinatorica's); this is Pólya's substitution of the power sums of the weights, or of the number of colors, into the cycle index. ReplaceAll with a rule list is simultaneous, as ours is.

See also: CycleIndexPolynomial, KNecklaces, KBracelets, PermutationGroup