MathSource Reviews

Snooker on a Lemniscate

Edited by Matthew M. Thomas

Asked to describe a nurturing environment for a budding engineer, mathematician, or scientist, few responsible people would point to the pool hall. Most would point to the lecture hall, library, and laboratory. Indeed, pool hall lectures tend only to be from sots, and there is very little by way of reading material in the pool hall. Especially lacking are formal reference works useful in rebutting the sots. The pool-hall-as-laboratory concept also has little support: The prerequisite scientific rigor is often lacking among the practicing technicians. Alcohol, tobacco, wagering, and poor lighting tend to have that effect in the laboratory. And yet, the tables in the pool halls offer a good deal of great physics. It is for that reason that this MathSource review hails, metaphorically, from a virtual pool hall, in which conservation of kinetic energy is as present as friction is absent, and in which the snooker and pocket billiards tables are unlike anything previously encountered. 
This review examines the MathSource package billiard.m, contributed to the archive in 1992 by David Glaubman, and modified to run on Macintosh and NeXT front ends by Sha Xin Wei. This billiard.m package was designed for version 2.0 of Mathematica, the current version as of 1992. The review briefly examines works on the science behind pocket billiards, for those of you interested in reading such works. It then describes the Mathematica code comprised by the billiard.m package, and puts that code to work in several examples of package use. It concludes with a summary of package strengths and weaknesses. If you are interested in using this package, do so with a system supporting a Mathematica front end, since graphical output is the primary (if not the only) output offered by the package.

The Science of Pocket Billiards

While the pool hall itself provides fodder for many a sociology treatise, the pocket billiards tables within the hall provide fodder for those interested in two-dimensional collisions and the like. The science of pocket billiards has been reviewed in many textbooks on physics and dynamics, and if one seeks a rigorous, classical, and time-worn treatment of the subject, one should go there. In terms of recent technical material, the World-Wide Web is the place to go, and we shall go there in a moment. But if you would like general information on and discussion about the many forms of pocket billiards, the Usenet newsgroup rec.sport.billiard would be your first stop. The FAQ (list of Frequently Asked Questions) for this newsgroup could be found (as of this late-December 1997 writing) at URL http://www.accessone.com/ mavlon/faq.txt; Bob Jewett (jewett@netcom.com) is the FAQ maintainer. You might also look into the Billiard Congress of America; bca@netins.net is the e-mail address for that organization. 
While it is easy to speak in a disparaging manner about the nature of pool halls, disparaging talk about the physics and mathematics behind pocket billiards would be most inappropriate. Many high-minded folk have addressed this latter topic in a very serious manner. To wit, consider the February 1997 contribution from Daniel Maynes-Aminzade, writing out of the Center for the Computation and Visualization of Geometric Structures (The Geometry Center) of the Univ. of Minnesota. As of this writing, his work, "Beyond Billiards," could be found at URL http://www.geom.umn.edu/ maynes/. Maynes-Aminzade begins with an imaginary discussion among astute mathematicians about pocket billiards. The mathematicians bring to bear the viewpoints of Plato (Socrates), Gottlob Frege, Nikolay Lobachevsky, Bertrand Russell, and Imre Lakatos on how math relates to billiards (imagine Steve Allen's "Meeting of the Minds" at one remove.) Maynes-Aminzade then addresses billiards on a unit square, with formal attention paid to the relevant geometry, and with answered questions about billiard ball path length under a variety of circumstances. He then extends the two-dimensional billiard table analysis to three-dimensional squash in a gravity-free unit cube, offers a glimpse of n-dimensional squash, and concludes with a well-written note on Mathematical model strengths and limitations. 
Maynes-Aminzade uses pocket billiards as a platform for discussing the theoretical travels of a point-source. (That, basically, is what we will do with the MathSource billiard.m package.) Ron Shepard, by contrast, confines his analysis to those pocket billiards tables plagued by such worldly woes as friction, dissipation of kinetic energy, and english on the ball. Shepard (shepard@tcg.anl.gov) writes out of the Argonne Pool League of the Argonne National Laboratory; his work, "Amateur Physics for the Amateur Pool Player," appeared at URL http://www.accessone.com/ mavlon/apapp.html as of this writing. The Shepard work was written in 1997 and is in its third edition. Said edition is a four-part, 107-page document in Adobe Acrobat PDF format, thus requiring the Adobe Acrobat Reader. A serious and practical analysis, this work examines billiards equipment (balls, tables, cue sticks and tips, table cloth), friction coefficients, table forces, moments of inertia, natural roll, cue tip and 
Two books are frequently cited as offering technical discussions on pocket billiards. The Science of Pocket Billiards by Jack H. Koehler has its focus on the practical matters of pocket billiards; it leaves the equations and what not to The Physics of Pocket Billiards by Wayland C. Marlow. More information on the Koehler book could be had as of this writing from URL http://www.bca-pool.com/koehler/jk-sopb.htm. The Marlow book appears not to have an affiliated web page; an apparently unaffiliated web page implies that it is available through the American Institute of Physics press (1-800-809-2247). An AltaVista search for the Marlow book revealed a 21 August 1996 post from Marlow himself to the TELOS Guest Book web page. The post asks if TELOS would be interested in marketing the book we now discuss. Marlow's e-mail address was smarlowe@rpsmaui.com on 21 August 1996; this address may still be valid. Since TELOS publishes this journal, consider Marlow's request implicitly granted.

Code behind billiard.m

You can get the billiard.m Mathematica package through either ftp or your web browser, among other means. The URL and the ftp address are the same: http://www.mathsource.com. The package is available as both ftp://www.mathsource.com/pub/Applications/Physics/0202-318/billiard.m and ftp://www.mathsource.com/pub/NumberedItems/0202-318-0011. The README file accompanying billiard.m cites David Glaubman and Sha Xin Wei as the package authors, and notes that the package, "given a planar region bounded by level curves, draws billiard trajectories." The 4 kB package was made available through MathSource in August 1992. As noted earlier, the package was based on Mathematica version 2.0, the current version in 1992. Other than the README file and the (* comments *) in the package itself, there appears to be no documentation available for billiard.m. Of course, for a 4 kB package, one need not spend much time writing documentation before the documentation exceeds the code. 
The billiard.m package begins by using BeginPackage[ ] to make the standard Graphics packages Animation and ImplicitPlot the active contexts. It then presents the usage message for the play[expression, options] function (not to be confused with the sound-generating Play[ ] function inherent in Mathematica since version 2.0). As noted in the usage message, play[ ] illustrates idealized billiard ball motion, on a table whose boundary is defined by the expression == 0 equation ("expression" is in terms of variables x and y; to wit, "expression" for an ellipse would be written as a (x^2) + (((b  y))^2) - 1, where a and b are constants). The usage message also warns that a user-supplied boundary test function is not implemented, and that there is no "sanity checking" or "error handling." As ever: Caveat emptor. 
The package follows its play[ ] usage message with Options[play], to assign default values to the package options. StartPt, the (x, y) starting point for billiard ball travels, is assigned {0,  .2} as its starting point. StartV, the initial direction of motion, is assigned {N[Sqrt[2]/2], N[Sqrt[2]/2]}—the default value for ball take-off is at an ArcCos[Sqrt[2]/2] = ArcSin[Sqrt[2]/2] = 45-degree angle to the +x-axis. The default NumPts value is set to 25, so that play[ ] might generate 25 cells of billiard ball motion unless instructed otherwise. The default boundary test (BdryTest) value is set to the bor- dertest[ ] function, which returns True if a point is within the "expression  < 0" region, and False otherwise. "Billiards" is a default title option. Usage messages for each option follow the Option[play] command. Note: For NumPts, the usage message implies that NumPts is "how many bounces to compute." In fact, NumPts is the number of cells generated by play[ ], the first of which displays only the "expression" boundary and the starting point. If you want to see n bounces, use NumPts -> n+1 within play[ ]. 
After dealing with the play[ ] options, the package defines the play[ ] function itself. While the previous paragraph explained the default play[ ] options, the default "expression" is the unit circle (x^2) + (y^2) - 1, so unless you assert otherwise, your billiard table will be circular. Given a starting point (StartPt) and initial direction of motion (StartV), the play[ ] function 1) computes the point at which a ball traveling from StartPt in StartV bounces off the table boundary, 2) computes the line tangent to the table boundary at the point found in the previous step, 3) computes the angle between the initial direction of motion and the tangent line found in the previous step, 4) uses information from the first three steps and the fact that incidence angle equals reflection angle to compute the new direction of motion, and 5) repeats these four steps for another "NumPts"-2 table boundary strikes. The bsearch[ ] routine within the play[ ] Module handles step one; the w = der[expr] process in that Module performs the partial differentiation necessary to handle step two. The dot product v.w provides the cosine of the angle in step three (v originally equals StartV), and the updated motion direction v is found from the vector expression (2 (v.w) w) - v in step four. Results from these steps are saved in table next[ ]. Graphics-based functions such as border[ ] within play[ ] use the next[ ] table to generate NumPts cells. 
In the billiard.m package available through MathSource, the border[ ] and oneframe[ ] functions within play[ ] are flawed (at least for use in a Mathematica 3.0 front end under Windows NT). These two functions generate only the right half of the blue billiard table boundary, and distort that boundary such that (for example) circles appear as ellipses. The entire boundary can be generated through changing all "0" values to ``-4" values in {Global`x, 0, 4} and in the PlotRange portions of border[ ]. The boundary distortion can be eliminated by rewriting oneframe[ ] as oneframe[n_] := Graphics[Line[Table[next[i], {i, 1, n}]], AspectRatio -> Automatic]. The border[ ] and oneframe[ ] functions were changed as such for this review; the results in the following section reflect these changes.

Examples using billiard.m

Using play[ ] in a pocket billiards context presupposes kinetic energy conservation and the absence of friction. We shall play along with these unrealistic assumptions, and add to them consideration of the billiard ball as a zero-diameter point-source. Comments in the billiard.m package suggest use of an ellipse as a table boundary, and the play[ ] function uses a unit circle as the default table boundary. In assessing the play[ ] function, we shall go beyond the circle and ellipse. 
Figure 1 features the play[ ] function (as do all of the following figures), with (0, .25) as the starting point on a circular table boundary centered at (0, 0). The initial motion direction is parallel to the +x-axis. With the NumPts option set to 200, 200 cells are generated by play[ ]; one can animate these cells within the Mathematica notebook. Figure 1 reproduces the 176th of those cells. The lesson here is that this starting point and initial motion direction produce paths that never encroach upon the concentric circle with center (0, 0) and radius .25—parameters set by the starting point and initial motion direction. The exercise left to the student is to vary y in the (0, y) starting point, and observe the corresponding changes in the"unencroachable" circle radius.

play[x^2 + y^2 - 1, StartPt -> {0, 0.25}, StartV -> {N[Sqrt[2]/2], N[0.]}, 
  NumPts -> 200]

Figure 1 - 176th cell created by the above play[] command. Note how the ball does not encroach upon a concentric circle of center (0,0) and radius 0.25 within the unit circle.

Figure 2 is identical to Figure 1, except that an ellipse sets the table boundary in lieu of the unit circle. Note that the unencroachable area is now also elliptical. The exercise now left to the student is to determine the unencroachable ellipse area as a function of starting point (0, y). Another exercise: Change the initial motion direction, and note the corresponding changes in billiard ball paths. With the mundane circular and elliptical table boundaries, our lesson appears to be that some initial conditions lead to very uneven cloth wear on some virtual billiards tables.

play[x^2 + 2*y^2 - 1, StartPt -> {0, 0.25}, StartV -> {N[Sqrt[2]/2], N[0.]}, 
  NumPts -> 200]

Figure 2 - 176th cell created by the above play[] command. The starting point and initial trajectory are the same as in Figure 1, but the boundary is now elliptical ((x^2)+2(y^2)=1), as is the unencroachable area.

Figure 3 is a radical departure from its first two counterparts. The function F(x, y) = 0 used to create the Figure 3 table boundary is a Lemniscate of Bernoulli, with first- and third-quadrant lobes, and with the point of lobe intersection at (0, 0). (The source of the review title should now be apparent.) We start in Figure 3 at ( .25,  .25); from there, we launch our ball at an ArcTan[Sqrt[1.5]] ⟶ 50.77-degree angle with the +x-axis. After 69 bounces in the upper-right lobe, the ball passes through the (0, 0) intersection point for its first bounce in the lower-left lobe. (The need for a zero-diameter point-source billiard ball should now be apparent.) Those inclined toward frequent intersection-point passage and one boundary contact point per lobe would opt for StartV = (Sqrt[2]/2, Sqrt[2]/2).

play[(x^2 + y^2)^2 - 2*x*y, StartPt -> {0.25, 0.25}, 
  StartV -> {N[Sqrt[2]/2], N[Sqrt[3]/2]}, NumPts -> 200]

Figure 3 - 73rd cell  created by the above play[] command. After wreaking havoc in the upper-right lobe for the first 70 cells, the ball passed through the origin in the 71st cell and has just begun to let fly in the lower-left lobe of this Lemniscate of Bernoulli. If you've not noticed, our ball is a zero-diameter point source. The unimaginative will prefer a ((Sqrt[2])/2,  (Sqrt[2])/2) initial trajectory from the (.25, .25) starting point.

The Figure 4 boundary is a lemniscate generalization known as an oval of Cassini. This oval is a lemniscate generalization from the previous figure, after a Pi/4-radian clockwise rotation. As such, a line of lobe intersection lies along the y-axis. The equation for this oval is \(TraditionalForm
      \`\((x\^2 + y\^2)\)\^2 - 2 \(\( e\^2\)(x\^2 - y\^2)\) - a\^4 + e\^4 = 0
        \): Isolated boundaries occur when a < e; a lemniscate occurs when a = e; Figures 4 and 5 are cases of a > e, with a = 1 in both cases, and with e = 0.95 in Figure 4 and e = (Sqrt[2]) / 2 in Figure 5. Note in Figure 4 how the ball makes repeated cuts across the right lobe, but then rides the left-lobe boundary before its imminent return to the right lobe.

play[(x^2 + y^2)^2 - 2*0.95^2*(x^2 - y^2) - 1 + 0.95^4, 
  StartPt -> {0.25, 0.25}, StartV -> {0., 1.}, NumPts -> 200]

Figure 4 - 14th cell  created by the above play[] command. Here, the boundary is an oval of Cassini, in which a = 1 and e = 0.95. For the given starting point and initial trajectory, the ball cuts a wide swath across the right lobe in the first seven cells, then rides the perimeter of the left lobe just before returning to the right lobe in cell 15. When aligned with the x-axis, the lemniscate in Figure 3 is a specific case (a = e) of an oval of Cassini.

Figure 5 is, as noted, another oval of Cassini. Figure 5 differs from its immediate predecessor, in that the top and bottom boundary sides appear to be parallel to each other and to the x-axis. Our StartPt here is ( .25,  .25), and our StartV is (0, 1), so the ball first makes contact with the boundary at \(TraditionalForm\`\((0.25, \(y\^*\))\)\), where \(TraditionalForm\`\(y\^*\)\) is determined through the bsearch[ ] routine. At x =  .25, the top side of this oval has a slightly negative slope, which is why the ball rebounds at an angle slightly more negative than -π / 2. Notice how the ball doesn't progress far into the left lobe before returning near the starting point; even after "NumPts"-1=199 bounces, the ball never gets any farther into the lobes than it does after the eighth bounce.

play[(x^2 + y^2)^2 - 2*(Sqrt[2]/2)^2*(x^2 - y^2) - 1 + (Sqrt[2]/2)^4, 
  StartPt -> {0.25, 0.25}, StartV -> {0., 1.}, NumPts -> 200]

Figure 5 - 14th cell  created by the above play[] command. The boundary is another oval of Cassini, but now a = 1 and e = (Sqrt[2])/2. Despite its appearance, the boundary is not perfectly parallel to the x-axis at x = .25 -- thus the ensuing path angles arising from an initial trajectory in the +y direction. (Perfect boundary parallelism to axis x occurs at x = 0: try a (0, .25) starting point.) These oval ends proved unencroachable through 200 cells.

Figure 6 features a hybrid boundary function, comprising an elliptical term and a hyperbolic term of sorts—out of ignorance, your reviewer has labeled the latter a "2-way hyperbola." The effect, however, is a rectangle with rounded ends, somewhat useful for illustrating the traditional pocket billiards table shape. One wonders whether legendary pool sharks Minnesota Fats and Willie Mosconi ever converted a shot such as that shown in Figure 6. The challenge remains to concoct a function F(x, y) = 0 in proper proportion to a standard pocket billiards table, or, say, to the 200-ft by 85-ft (with 28-ft-radius rounded corners) standard National Hockey League rink specified by League Rule 2a.

play[(x^2 - 3*y^2)^2 + (x^2 + 3*y^2) - 1, 
  StartPt -> {0., 0.}, 
  StartV -> {0.5, 1.}, NumPts -> 5]

Figure 6 - "Off the top side, off the corner pocket padding, back off the top side, and into the bottom side pocket." Fifth cell  created by the above play[] command. Note the functional chicanery we resort to for casting a pocket billiards table in F(x,y) = 0 form.

Finally, Figure 7 features the 2-way hyperbola by itself. These shapes are fun to explore (albeit somewhat impractical for billiards tables manufacturers). The boundary in Figure 7 implies a four-way intersection of streets that run northeast, northwest, southwest, and southeast (with "north" in the +y direction). In our example, we launch the ball from the intersection center, at a 60-degree angle to the +x-axis. Figure 7a shows an initial foray into the northeast street through the fifth bounce. Figure 7b shows a retreat from northeast, a three-bounce flirtation with the mouth of southwest, five subsequent bounces at the southeast mouth, and a final bounce in the cell (nineteenth, overall) off a point near (-1, 0). Figure 7c shows the result of bounce 19—an extended foray northeast. Tuning the 2-way hyperbola, starting point, and initial motion direction can lead to ball paths that are, to say the least, interesting.

play[(x^2 - y^2)^2 - 1, StartPt -> {0., 0.}, 
  StartV -> {Sin[Pi/6], Cos[Pi/6]}, NumPts -> 50]

Figure 7 - The "2-way hyperbola" provides the "narrowing streets" boundary. In Figure 7a [cell 6 created by the above play[] command], the ball makes its way northeast, but retreats in Figure 7b [cell 20] to the southwest and southeast passage openings before revisiting the northeast route in Figure 7c [cell 30]. Since the passages narrow to a point, the ball may eventually return to the "intersection."

Summary

Glaubman and Wei have written a useful, if not polished, Mathematica package. The analogy to pocket billiards serves billiard.m well, as it puts users in the proper frame of mind for what the package illustrates. There is much room for better package documentation, and the deficiencies in functions border[ ] and oneframe[ ] might have been corrected before the package went to MathSource. A more colorful presentation of the graphics output would also have increased package popularity. Nonetheless, not all of the package weaknesses are the fault of the package developers. To wit, the package relies heavily upon the ImplicitPlot[ ] Graphics function, and any problems with ImplicitPlot[ ] affect the play[ ] function adversely. There are also functions which, through no fault of billiard.m or Implicit- Plot[ ], cannot be handled because of their ill-behaved partial derivatives. The astroid (x^(2/3)) + (y^(2/3)) = (a^(2/3)) and the evolute of an ellipse \(TraditionalForm
      \`\((a  x)\)\^\(2/3\) + \((b  y)\)\^\(2/3\) = 
        \((a\^2 - b\^2)\)\^\(2/3\)\) are examples of such functions: Their partial derivatives cause trouble at x = 0 and y = 0. 
As it is, billiard.m can be the foundation for a larger package on analytic geometry and vector differential calculus. It can even be the foundation for very creative games. Imagine the output from play[ ], but with a unit tangent and unit normal vector displayed at the site of each bounce, and with a new motion direction explicitly defined after each bounce. Additional calculations involving curvature, radius of curvature, and torsion could also be made and displayed with each bounce. While the boundaries defined herein might be too much for billiard table manufacturers, they could be more readily incorporated into video games. Imagine the staid Pong video game, played not on a rectangular court but on one defined by a hybrid of diverse functions: The players would have to play their angles much more carefully. Better yet, give the players some level of control over boundary function parameters during the game, or have the boundary change with time during the game. The game would be exciting and educational, and when fun equates to learning, a major goal has been met.

About the Author

Matthew M. Thomas completed his doctorate in chemical engineering at Washington University in St. Louis, in December 1995. The batch chemical process quality control aspects of that work are meticulously explained in the October 1997 issue of the Mathematica Journal, with a related news item in the Chemical Engineering Progress issue from the same month. 

thomas@wuche2.wustl.edu