Symmetric and Almost Symmetric Polygons

This Java applet constructs certain symmetric or almost-symmetric polygons, as described in the article by Peter Giblin and Matthew Trout in the Mathematical Gazette for November 1997, pages 381-390. The construction requires three numbers p, k, a and p is taken as prime in the paper, but it does not need to be. It is essential that a and p have no common factor.

The idea is as follows. Let t be the angle 2*pi/p^k. Start with a horizontal line, of length 1 say. Draw at the end a line of length 1 at an angle (a-1)t with the horizontal. At the end of this line draw a line of length 1 at an angle (a^2-1)t. At the end of this line draw a line of length 1 at an angle (a^3-1)t with the horizontal, and so on. Usually the resulting polygon will close, but not always. The theory and some examples are in the paper cited above. For example, try p=5, a=182 and k=1, 2, 3, 4, 5 in succession. In the special case a=2 the rule for drawing lines can be re-expressed by saying that the angle with the horizontal doubles at each step.

When it is first run, the applet draws the polygon associated with the triple p=3, k=4, a=4. You can change the numbers by clicking on the boxes at the bottom, typing in a new set of numbers, and clicking on Go to re-run the applet. If p^k is fairly large it may take a while to run, so be patient.

When the polygon closes, it does so after a certain number of sides. (This is the "order of a mod p^k".) The number of sides appears in the top right of the window. The side drawn in RED is the next side, after this number of sides, determined by the above rule. So for a closed polygon the red side overlays the first side of the polygon, while for a non-closed one it just ends in mid-air.

If you accidentally (or deliberately!) type in a and p with a common factor then the applet will not run but will warn you of your mistake. It is also limited to drawing polygons with fewer than 5000 sides, so some choices of p, k, a will not work.

Sometimes the completed polygon appears to have symmetry about a line, or glide symmetry (p=997, k=1, a=2 for example). This symmetry is only approximate . The rotational symmetry, however, revealed for example in the default example p=3, k=4, a=4, is exact. The secrets are revealed in the paper cited above.