Function Repository Resource:

ShowPolygonSymmetries

Source Notebook

Visualize dihedral group symmetries

Contributed by: Naman Taggar

ResourceFunction["ShowPolygonSymmetries"][n,{s1,s2,,sk}]

applies the dihedral group symmetries {s1,s2,,sk} in sequence to the regular polygon with n sides showing each step.

ResourceFunction["ShowPolygonSymmetries"][n,s]

applies the single dihedral group symmetry s to the regular polygon with n sides.

Details and Options

ShowPolygonSymmetries takes the n-sided regular polygon along with a list of dihedral group symmetries {s1,s2,,sk} and returns the image of the polygon after applying each si together with the original state.
ResourceFunction["ShowPolygonSymmetries"] returns a list of Graphics objects.

Examples

Basic Examples (2) 

Rotate a pentagon by two units:

In[1]:=
ResourceFunction["ShowPolygonSymmetries"][5, Cycles[{{1, 3, 5, 2, 4}}]]
Out[1]=

Rotate a pentagon by two units and then reflect it by third index. Each pentagon shows the result of transformation after applying the respective operation, with the first one being the original pentagon.

In[2]:=
ResourceFunction["ShowPolygonSymmetries"][
  5, {Cycles[{{1, 3, 5, 2, 4}}], Cycles[{{1, 5}, {2, 4}}]}] // GraphicsRow
Out[2]=

Scope (2) 

Apply a single symmetry:

In[3]:=
ResourceFunction["ShowPolygonSymmetries"][3, Cycles[{{1, 3}}]]
Out[3]=

Symmetries can be provided as permutation lists:

In[4]:=
ResourceFunction["ShowPolygonSymmetries"][3, {3, 2, 1}] // GraphicsRow
Out[4]=

Options (1) 

Change size of the graphics objects using the ImageSize option:

In[5]:=
ResourceFunction["ShowPolygonSymmetries"][3, {{1, 2, 3}, {3, 2, 1}}, ImageSize -> Tiny] // GraphicsRow
Out[5]=

Neat Examples (1) 

Visualize all symmetries of a triangle:

In[6]:=
Column@Table[
  Labeled[
   GraphicsRow[
    ResourceFunction["ShowPolygonSymmetries"][3, x, ImageSize -> Tiny]],
    x, Right],
  {x, GroupElements[DihedralGroup[3]]}
  ]
Out[6]=

Publisher

Naman Taggar

Requirements

Wolfram Language 12.0 (April 2019) or above

Version History

  • 1.0.0 – 25 June 2025

Related Resources

License Information