The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CM::Group::Dihedral - An implementation of the finite dihedral group D_2n

DESCRIPTION

This group is formed of the reflectional and rotational symmetries of a regular polygon with n edges. It is also the symmetry group of a regular polygon.

SYNOPSIS

        use CM::Group::Dihedral;
        my $g = CM::Group::Dihedral->new({n=>10});
        $g->compute;
        print "$g";

        1 10  9  8  7  6  5  4  3  2  19 18 17 16 15 14 13 12 11 20
        2  1 10  9  8  7  6  5  4  3  18 17 16 15 14 13 12 11 20 19
        3  2  1 10  9  8  7  6  5  4  17 16 15 14 13 12 11 20 19 18
        4  3  2  1 10  9  8  7  6  5  16 15 14 13 12 11 20 19 18 17
        5  4  3  2  1 10  9  8  7  6  15 14 13 12 11 20 19 18 17 16
        6  5  4  3  2  1 10  9  8  7  14 13 12 11 20 19 18 17 16 15
        7  6  5  4  3  2  1 10  9  8  13 12 11 20 19 18 17 16 15 14
        8  7  6  5  4  3  2  1 10  9  12 11 20 19 18 17 16 15 14 13
        9  8  7  6  5  4  3  2  1 10  11 20 19 18 17 16 15 14 13 12
        10  9  8  7  6  5  4  3  2  1 20 19 18 17 16 15 14 13 12 11
        11 20 19 18 17 16 15 14 13 12  9  8  7  6  5  4  3  2  1 10
        12 11 20 19 18 17 16 15 14 13  8  7  6  5  4  3  2  1 10  9
        13 12 11 20 19 18 17 16 15 14  7  6  5  4  3  2  1 10  9  8
        14 13 12 11 20 19 18 17 16 15  6  5  4  3  2  1 10  9  8  7
        15 14 13 12 11 20 19 18 17 16  5  4  3  2  1 10  9  8  7  6
        16 15 14 13 12 11 20 19 18 17  4  3  2  1 10  9  8  7  6  5
        17 16 15 14 13 12 11 20 19 18  3  2  1 10  9  8  7  6  5  4
        18 17 16 15 14 13 12 11 20 19  2  1 10  9  8  7  6  5  4  3
        19 18 17 16 15 14 13 12 11 20  1 10  9  8  7  6  5  4  3  2
        20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1


        $g->rearrange; # we rearrange so that identity sits on the first diagonal
        print "$g";


         1 10  9  8  7  6  5  4  3  2 19 18 17 16 15 14 13 12 11 20
         2  1 10  9  8  7  6  5  4  3 18 17 16 15 14 13 12 11 20 19
         3  2  1 10  9  8  7  6  5  4 17 16 15 14 13 12 11 20 19 18
         4  3  2  1 10  9  8  7  6  5 16 15 14 13 12 11 20 19 18 17
         5  4  3  2  1 10  9  8  7  6 15 14 13 12 11 20 19 18 17 16
         6  5  4  3  2  1 10  9  8  7 14 13 12 11 20 19 18 17 16 15
         7  6  5  4  3  2  1 10  9  8 13 12 11 20 19 18 17 16 15 14
         8  7  6  5  4  3  2  1 10  9 12 11 20 19 18 17 16 15 14 13
         9  8  7  6  5  4  3  2  1 10 11 20 19 18 17 16 15 14 13 12
        10  9  8  7  6  5  4  3  2  1 20 19 18 17 16 15 14 13 12 11
        19 18 17 16 15 14 13 12 11 20  1 10  9  8  7  6  5  4  3  2
        18 17 16 15 14 13 12 11 20 19  2  1 10  9  8  7  6  5  4  3
        17 16 15 14 13 12 11 20 19 18  3  2  1 10  9  8  7  6  5  4
        16 15 14 13 12 11 20 19 18 17  4  3  2  1 10  9  8  7  6  5
        15 14 13 12 11 20 19 18 17 16  5  4  3  2  1 10  9  8  7  6
        14 13 12 11 20 19 18 17 16 15  6  5  4  3  2  1 10  9  8  7
        13 12 11 20 19 18 17 16 15 14  7  6  5  4  3  2  1 10  9  8
        12 11 20 19 18 17 16 15 14 13  8  7  6  5  4  3  2  1 10  9
        11 20 19 18 17 16 15 14 13 12  9  8  7  6  5  4  3  2  1 10
        20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1

These are labels of the elements and not the elements themselves(which internally are represented as permutations).

You can also see a coloured Cayley table(the labels of the permutations are associated to colours):

This is the Cayley graph of D_5:

AUTHOR

Stefan Petrea, <stefan.petrea at gmail.com>