Plot Window
This window is the McBilliards plotter.
Basic Definitions: Here are
a few definitions which are basic to this window,
and to all of McBilliards.
A word is a finite string
in the digits 1,2,3. The shortest word of
interest to us is 123123. A periodic billiard
path in a triangle gives rise to an infinite
repeating word in the following way: We label
the sides of the triangle by the digits 1,2,3,
and then simply record which sides are hit
as the path goes about its business. In
describing such infinite periodic words,
we list a single period. W is called the
combinatorial type of the billiard path.
Each point in this window
represents a triangle. Specifically, the
point (x,y) represents the triangle, two
of whose angles are 90x and 90y.
Given a word W, the orbit tile O(W) is
defined as the set of points (x,y) which
correspond to triangle having a periodic
billiard path of combinatorial type W. We sometimes call O(W) the
tile for short
Operation
Given a word W, this window plots the
orbit tile O(W).
There are 6 plotting modes:
- Pack: Produces a finite union P(D) of dyadic squares,
each of which is quaranteed to be contained in O(W).
- Cover: Produces a finite union C(D) of dyadic squares which is guaranteed to contain O(W)
- Fill Produces a set of the form F(D)=P(D) union L(D), where L(D) is obtained by
taking each square in the set C(D)-P(D) and chopping it down according
to the linearizations of the functions which define the edges of the tile
- Zone: Produces a partition of F(D) into smaller pieces, each of which
corresponds to a combinatorially stable configuration of the unfolding.
To appreciate this mode you should open up the unfolding window and
turn on the leaders function, then click on different pieces in the
partition produced by the zone mode and watch the unfolding.
- B-Like: Produces a convex linear polygon which is guaranteed to contain O(W).
- new: Currently does nothing. This is just a berth for a new mode
should we decide to add one.
For each of the first 3 plot modes, there are 3 drawing modes.
- Solid: Produces a solid picture.
- Seams: Shows the breakdown of the above mentioned asets into their component squares
- Local: For all the modes except Zone and B-Like, this plots the single
box which contains the point in the tile on which you have clicked.
If you have clicked outside the tile, nothing is returned.
The purpose of the local mode is to allow the user to completely
trace through the calculations made by our plotting algorithm.
The local mode is meant to be used in tandem with the unfold window.
We will explain this at the end of this documentation.
tandem
The solid and seams modes also work with the Zone plotter, but the local mode
does something different. Namely, it returns the piece of the partition which contains the current point in parameter space.
There is one additional button on the console which requires
explanation. The little box at the top left is a technical
setting which under ordinary cirumstances should be left on.
During the course of its business, our plotter looks at all
the vertices of an unfolding corresponding to W.
Pat has an algorithm which eliminates some of these vertices
from consideration in an a priori way. When the little
square on the console is on, Pat's filter is used.
When it is off, the filter is not used. The "off" option
is for purists, interested in rigorous proofs, who do not
want to take the time to see that Pat's filter works
correctly.
OPERATION OF PLOTTING MODES
The Elimination Algorithm:
All the plotting modes
use a certain algorithm, which we call the Elimination Algorithm, E.
We will explain about this algorithm below. For now, we will
use the Elimination Algorithm as a black box. The input to
E is a dyadic square Q and a word W. There are 4 outputs
of E(Q,W), namely:
- Outside: Q is disjoint from O(W)
- Inside; Q is a subset of O(W)
- Cross: Q intersects the boundary of O(W)
- Unsure: Cannot decide.
We will explain more about this algorithm below.
Pack:
The pack method maintains a list List of dyadic squares, starting with the
unit square. Letting Q be the first square on the current list
we compute E(Q,W). Depending on the outcome we do the following:
-
Outside: Eliminate Q from the list.
- Inside: Eliminate Q from the list and append Q to a second list, Inside.
- Cross: There are 2 options here:
- If Q is larger than a given threshhold size, set by the DETAIL button,
we replace Q on the list by its subdivision into 4 subsquares of half the size.
- If Q is smaller than the given threshhold, we eliminate Q from the list.
- Unsure: We replace Q on the list by its subdivision into 4 subsquares of half the size.
Once the List is empty, our algorithm halts and takes its packing to be
all the squares in the list Inside. By increasing the level of detail, we make Inside
contain more squares. If the level of detail was infinite, Inside would
contain an infinite collection of squares whose union would be exactly O(W).
So, the pack method would give arbitrarily good inner approximations to O(W)
given an infinite computer.
Cover: The cover method does the same thing as the pack method,
except that the basic algorithm is modified. The reaction to the 3rd
outcome above is replaced by the following one:
- Cross: There are 2 options here:
- If Q is larger than a given threshhold size, set by the DETAIL button,
we replace Q on the list by its subdivision into 4 subsquares of half the size.
- If Q is smaller than the given threshhold, we eliminate Q from the list
and append it to a second list, Slop
When the algorithm halts, the union of the squares in Inside and Slop
form a covering of O(W).
All the same remarks about the level of detail apply here. Thus, on an
infinite computer, the covering mode would produce arbitrarily good
outer approximations to O(W).
Fill: The fill method first runs the algorithm as in the Cover
mode. Then, each square Q in Slop is replaced by a convex polygon
L(Q). The convex polygon L(Q) is obtained from Q by chopping it down
according to our Polygon Chopper algorithm, which we explain
below in detail. Roughly speaking L(Q) is the intersection of
Q with a convex linearized version of O(W). If Q is small, then
the L(Q) is a very good approximation to Q intersect O(W).
The union of the squares in Inside and the chopped squares from
Slop comprises the object plotted by the Fill method.
This object is typically neither an inner nor an outer
approximation, but is nonetheless an extremely accurate
approximation in practice.
Zone It turns out that O(W) is defined as the set of points on which
a certain finite union of functions are positive. This gives a natural
partition of O(W) into finitely many pieces. Each piece corresponds to a
region where a different function is minimized. The Zone mode plots all
these regions, thereby giving a canonical partition of O(W). Each region
is plotted using the Fill mode. In practice, we just add a condition
to the Elimination Algorithm which replaces O(W) by one of these subregions.
THE ELIMINATION ALGORITHM
The setup The elimination algorithm starts with a pair (Q,W), where Q
is a dyadic square, and produces one of the 4 outcomes above. Here we explain
what does into this algorithm.
Defining functions:
This explanation assumes that you know that the unfolding U(W,x) is. In brief,
U(W,x) is a sequence of length(W) triangles, with consecutive ones being
related by a reflection in a common edge. The choice of edges is dictated
by the digits of W. Now, there is a finite list of vertices, called TOP,
which runs across the top of the unfolding, and there is a finite list of
vertices called BOT, which runs along the bottom. TOP and BOT have
the same number of vertices, and this number is exactly half the
wordlength of W. The point x belongs to O(W) iff all the vertices of
TOP lie above all the vertices in BOT, assuming that the translational
holonomy of U(F,x) is horizontal. (The first and last edges of U(W,x)
are parallel and the translational holonomy carries one edge to the other.)
Let (t,b) be a pair of vertices, with t in TOP and b in BOT. There
is a corresponding function f(t,b;x) which describes the height of t
minus the height of b for U(W,x). The set O(W) is the set of points
where all these functions are positive. It turns out that f(t,b)
is always a finite trigonometric sum. The unfolding widow of
McBilliards computes and displays these functions. If
t1 and t2 are both in TOP, we can define f(t1,t2) in a similar
way. Likewise we can define f(b1,b2). These, then, are the
defining functions.
The quadrant algorithm:
The input to the quadrant algorithm is a pair (Q,f) where Q is a
dyadic square and f is one of the defining functions mentioned above.
There 4 outputs
- Positive: f is guaranteed to be positive on Q.
- Negative: f is guaranteed to be negative on Q.
- Mixed: f takes both signs on Q.
- Unsure
Our algorithm heavily relies on the specific form for f as a
finite trigonometric sum. In brief the algorithm works
by using a priori bounds on the second derivatives of f to
establish that the gradient of f lies in a quadrant. Then
the algorithm evaluates f at a single, well chosen point,
to show that it is either positive or negative on Q.
Should this fail, the output is Unsure. We will explain
more about this algorithm below. For now, we use it as
a black box. The simplest use of the quadrant
algorithm would just be to consider all pairs f(a,b).
However, this requires considering O(N^2) functions,
where N is the length of the word. We will describe
a more sophisticated approach which requires us to
use just O(N log N) such functions.
The Tournament
Let t1,t2,...,tk be a list of TOP vertices.
We can apply the quadrant
algorithm to the pairs (t1,t2), (t2,t3), etc. If the quadrant algorithm
ever returns a positive or a negative, we eliminate the appropriate
vertex. Going through all the pairs we thus produce a possible
smaller list of survivors. We call this process a TOP round.
Now, for the TOP tournament,
we start with the complete list of top vertices, and play rounds until
the list stabilizers.
We define the list of TOP winners to be those vertices which appear on the
final list. If t' is not a TOP winner then there is some TOP winner
t such that t lies below t' through out the square Q. We make all
the same constructions with BOT in place of TOP. If b' is not a BOT
winner then there is some BOT winner b which lies above b' throughout Q.
The playoffs:
Typically there is a very small number of TOP winners and a very small
number of BOT winners. To finish our Elimination Algorithm we apply
the quadrant algorithm to all the functions f(t,b) where t is a TOP winner
and b is a BOT winner. There are several possibilities:
- If all these functions are positive on Q then Q lies in O(W).
- If one of these functions is negative on Q then Q is disjoint from O(W).
- If all of the functions are mixed, then Q crosses O(W).
- Otherwise we are unsure.
THE QUADRANT ALGORITHM
Octahedral quadrants
We say that a quadrant in the plane is octahedral if it is bounded
by two 8th roots of unity. There are 8 octahedral quadrants, and
they are of two kinds:
- even: These are the standard quadrants bounded by rays contained
in the coordinate axes.
- odd: These are the rest.
Each odd quadrant is obtained by rotating an even quadrant by 45 degrees.
There are 2 squares naturally associated to Q, namely:
even(Q)=Q
odd(Q) is obtained by rotating Q by 45 degrees and dilating the result so that
it has twice the area. Note that even(Q) is midscribed in odd(Q).
Certified functions
Let dF be the gradient of the function f.
We say that f is even certified on Q if the
df lies in an even quadrant throughout even(Q). We say that f is
odd certified if df is contained in an odd
quadrant throughout odd(Q). We say that f is
certified if f is either even or odd certified on Q.
Suppose f is even certified. One of the vertices v of
Q is such that quadrant containing dF is a translate of
the quadrant implicitely defined by the portion of Q near v.
Let v' be the opposite vertex. Note that
- f is positive on
Q iff f(v) and f(v') are both positive.
- f is negative on Q
iff f(v) and f(v') are both negative.
When f is odd certified, the situation is less definitive:
- f is positive on Q if f(v) and f(v') are both positive.
- f is negative on Q if f(v) and f(v') are both negative.
The quadrant algorithm attempts to certify f. If this fails then
the answer Unsure is returned. If f is certified, then we make
the above evaluations to try to obtain the sign of f. If this
fails then the answer Unsure is returned. Otherwise, the
answer Positive or Negative is returned.
The certification process:
We can write
f(x,y)= a1 sin(b1 x+c1 y) + ... aN sin(bN x + cN y)
These constants are all real, and depend only on the combinatorics of the word W
and the choice of vertices corresponding to f.
We have the following global bounds on the second partial derivatives of f:
-
|f_xx| <= A11:= a1 b1 b1 + ... + aN bN bN
-
|f_xy| <= A12:= a1 b1 c1 + ... + aN bN cN
-
|f_yy| <= A22:=a1 c1 c1 + ... + aN cN cN
Let r be half the side length of Q. Let V=(V1,V2) be the gradient of f evaluated
at the center of Q. Throughout Q, we have the following bounds:
-
The x coordinate of df is contained in V1 +/- r (A11+A12)
-
The y coordinate of df is contained in V2 +/- r (A12+A22)
This we have a little error box for df throughout Q. If
this error box is contained in one of the even octahedral
quadrants then f is even certified. A similar calculation
works in the odd case. The unfolding window displays all
these quantities for any given defining function, so you can
see the calculations in action.
USING THE LOCAL MODE
If you plot a tile using the seams mode, you can see all the
dyadic squares which appear in our final plot. If you click on
one of these squares and then redo the plot in the local mode,
you will see just this square. If you again click on this square,
with the unfold window open, you will see an extra little window
appear at the bottom of the unfold window. This extra window
contains the list of decisive matches from the TOP and BOT
tournaments, and also a list of all the playoff matches.
These matches are listed as little numbered rectangles.
If you cliek on one of the numbered rectangles you get to
see the function corresponding to the associated pair of
vertices. By inspecting the unfold window you can see
for formula for the function, as well as all the quantities
mentioned above. In this way, you can spot check that
our algorithm is working correctly.
ENHANCEMENTS
Our algorithm uses a number of enhancements to make it run faster. For instance,
it makes use of the treelike structure of the set of dyadic squares so as
to minimize the amount of calculations it needs to make. The most
important enhancement is the use of Pat's billiard like tile.
The billiard-like tile BL(W) is a convex polygon, computed from
combinatorial data, which is guaranteed to contain O(W). When we
have a dyadic square Q we first check if Q is disjoint from BL(W),
just using linear algebra. This eliminates a vast percentage
of the squares with almost no effort. The algorithm which produces
BL(W) is explained in detail in Pat's thesis. At some point we
will document it here.
Pat's algorithm also eliminates some of the TOP and BOT vertices
from consideration. This is the filter we mentioned
above.