# McBilliards II

The long awaited sequel to McBilliards has finally arrived!

McBilliards II is a collection of Java programs written to investigate periodic billiard trajectories in polygons.

The comment that the "sequel has arrived" was a joke. The original McBilliards was developed actively for many years by Rich Schwartz and I, while this program was written by me alone in a few weeks. Nonetheless, this program has been used to produce new results about polygonal billiards.

## What McBilliards II does:

Currently, the program allows the user to search for periodic billiard paths in arbitrary convex polygons. However, making the program work for non-convex polygons would not require too much effort. It also draws the unfolding of a periodic billiard path.

## Running McBilliards II:

• The file can be run in various ways, commented on below. We always run the program on the command line from the directory containing the file mcb2.jar.
• Search Mode: The program can be used to list periodic billiard paths in a given convex polygon with vertices whose coordinates are rational. The program lists all periodic billiard paths up to a given combinatorial length.

The following line will search for all periodic billiard paths of combinatorial length less than 20 in the convex quadrilateral with rational vertices (0,0), (1,0), (1,1), and (-1/3, 1/2):

java -cp mcb2.jar Search -v 0 0 -v 1 0 -v 1 1 -v -1/3 1/2 -d 20

The output should be similar to:

The program will print out all combinatorial types of periodic billiard paths of even combinatorial length less than 20 in the polygon with vertices {0+ i*0, 1+ i*0, 1+ i*1, -1/3+ i*1/2}.
012102
0120121020201202
012021023103201202
0120210202
012020120210231032
01202021321232120323
01230132
01231321023132
123123

These sequences of numbers represent the orbit type of a periodic billiard path, i.e. the sequence of edges hit by the billiard path. The numbers of edges are assigned increase by one as you move in the counterclockwise around the shape. The edge with label "0" is the edge joining the first two vertices listed on the command line.

In general, the program will do this calculation for any convex polygon with rational vertices. The vertices must be listed in counterclockwise cyclic order.
• Stable Search Mode: This mode is similar to the previous search mode, except that in this mode only orbit types of stable periodic billiard paths are listed. A periodic billiard path in an n-gon P is stable if there is an open set U of polygons containing P so that every polygon in U has a periodic billiard path with the same orbit type. This search should be faster than the standard search mode.

The directions for running in this mode are identical, except that we replace "Search" with "StableSearch" in the command line:

java -cp mcb2.jar StableSearch -v 0 0 -v 1 0 -v 1 1 -v -1/3 1/2 -d 20

The output should be:

The program will print out all stable periodic billiard paths of length less than 20.
01202021321232120323
123123
• Unfolding Mode: In this mode, the program opens a window and displays an unfolding of a periodic billiard path. The command is called like this:

java -cp mcb2.jar Unfolding -v 0 0 -v 1 0 -v 1 1 -v -1/3 1/2 -d 20 -ot 01202021321232120323
Here, I have copied the orbit type from the search results above. A window will pop up which displays the following image:
Pressing the "M" key opens a menu for zooming in and out the image. By typing "M" then selecting "Zoom In" and drawing a rectangle, we obtain an image such as:
Lines contained in the interior of the translucent yellow strip fold up to form billiard paths in the given quadrilateral.

## Source code:

The source code is contained in the following zip file: mcb2-src.zip. The code is licensed under the GPL version 2 or any later version.

## Users of this program, and new mathematical results:

This program was actively used by Hai Bin Chang (undergraduate, National University of Singapore) and Yilong Yang (undergraduate, Brown University) during their participation in the SUMMER@ICERM Undergraduate Research Program. I would like to thank them for helpful suggestions which improved this software. Hai Bin and Yilong are currently completing the writing of a research paper "Billiards in near rectangles," which proves that quadrilaterals which are sufficiently close to being rectangles have periodic billiard paths.

## Prospects for future development:

The program will be further developed on an as needed basis. The underlying algorithms used can be used to detect closed geodesics on geometric structures on surfaces (or billiard tables) modeled on the plane. Here we could think of a surface as defined by a union of polygons with edges identified by affine maps for instance. The program can be extended to do exact arithmetic in any finite extension of the rationals. So, in principle the program can be used to rigorously find closed geodesics on surfaces with (G,X)-structure, where X is the plane and G=Aff(2,F), the affine group of the plane which preserves F2.

Please feel free to contact me if you would like the program to do more, or would like to assist in further developing the program.

Hooper >>>>> Visual >>>>> McBilliards II