Orders and structures

Pólya counting

How many different necklaces of six beads in two colours are there, when turning or flipping a necklace gives the same one? Burnside's lemma counts orbits by averaging fixed points, and Pólya's cycle index makes that a polynomial you can substitute into.

Burnside's lemma

A group GG acting on a finite set has

#orbits=1∣G∣∑g∈G∣Fix⁡(g)∣ \#\text{orbits} = \frac{1}{|G|} \sum_{g \in G} |\operatorname{Fix}(g)|

orbits. For colourings of nn positions with kk colours, a permutation with c(g)c(g) cycles fixes kc(g)k^{c(g)} colourings, since each cycle must be one colour.

import { symmetry, countColourings, cycleIndex, patternInventory } from "@ratmath/discrete";

countColourings(symmetry.cyclic(6), 2);      // 14n necklaces
countColourings(symmetry.dihedral(6), 2);    // 13n bracelets
countColourings(symmetry.cubeFaces(), 3);    // 57n ways to colour a cube's faces

The cycle index

cycleIndex(symmetry.dihedral(4)).toString();
// "(1/4) s4 + (1/4) s1^2 s2 + (3/8) s2^2 + (1/8) s1^4"
patternInventory(symmetry.dihedral(4), ["r", "b"]).toString();
// "r^4 + r^3b + 2r^2b^2 + rb^3 + b^4"

The cycle index records the cycle type of every group element: Z(G)=1∣G∣∑g∏isici(g)Z(G) = \frac{1}{|G|}\sum_g \prod_i s_i^{c_i(g)}, where ci(g)c_i(g) is the number of ii-cycles. Substituting si=ks_i = k gives the count above. Substituting si=ri+bis_i = r^i + b^i gives the pattern inventory, which counts orbits by how many of each colour they use: the square has two different colourings with two red and two blue corners, adjacent or opposite.

Groups

symmetry provides the cyclic, dihedral and symmetric groups and the 24 rotations of a cube acting on its faces. Any group works when given as { degree, generators } with 0-based permutations, or as a PermGroup from @ratmath/algebraic, such as the automorphism group of a graph from Isomorphism and spectra.

Try itEdit the code and run it with @ratmath/discrete and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.
Ctrl/⌘ + Enter runs