Chaos and Chance: Simulating a Two

Chaos and Chance: Simulating a Two-Dimensional Die Roll
Joseph R. H. Smith
Physics Department, The College of Wooster, Wooster, Ohio 44691, USA
(Dated: May 8, 2014)
Rolling dice is typically considered a random process, yet classical mechanics dictates the outcome
of each roll. A computer simulation is developed to model a two-dimensional die roll of an n-sided
die on a flat table. The simulation shows that die rolling is not random, yet chaotic behavior can
limit the control one has over the outcome of a die roll. As the number of sides increases, so does
the presence of chaos in the system. Dice rolls constrained by vertical walls on either side of the
table are considered and, for some initial conditions, the presence of walls is shown to decrease the
system’s sensitivity to initial conditions.
I.
INTRODUCTION
From governing the flow of board games, to arbitrating the outcome of high-stakes wagers, dice rolls are presumed to provide truly random outcomes. Archaeological
findings in India, such as the die pictured in Fig. 1, date
the invention of dice to over 4000 years ago [1]. Throughout history the prevalence and popularity of dice games
have increased, making dice rolls one of the most influential forms of entertainment.
While probability dictates that the chance for a fair
n-sided die to land on a given side is 1/n, classical mechanics provides a deterministic result for each set of initial conditions. The answer to this paradox lies in the
field of nonlinear dynamics and the study of chaotic phenomena [2]. Chaotic behavior is characterized by small
changes in initial conditions leading to drastic changes in
the final state of the system. For an ordinary die roll,
chaos is indistinguishable from randomness when the initial conditions must be so precise that the person rolling
the die cannot consciously control the outcome.
Casinos use dice such as the one pictured in Fig. 1.
These dice have sharp corners and their holes are filled
in with a material that has an equivalent density to the
rest of the die. These dice are manufactured to provide an
unbiased outcome, and their uniform construction makes
them appropriate for modeling the behavior of a die roll.
With the aim of decreasing the control one has over the
outcome, dice are first thrown against the wall of the
table before coming to rest in some dice games.
In 1983, Joseph Ford approached this discrepancy between probability and determinism by examining a simple coin toss [4]. Subsequent research into the mechanics
of coins, dice, and the game of roulette has shown that
the parameter spaces of these systems have both basins
of attraction where similar initial conditions produce the
same outcome, along with regions exhibiting chaotic behavior [1, 5, 6].
Through the development of a computer simulation,
this paper investigates a die roll in two dimensions with
n-sided dice represented as regular n-gons having three
degrees of freedom. The model simplifies the considerations of a three-dimensional model, while retaining the
probabilistic expectations for the system. A simple collision model is implemented to update the motion of the
die after each collision with the table, and these techniques are extended to include collisions with vertical
walls [7, 8]. The outcome of a die roll is typically described by the top face of the die, although the dice considered here allow for two top faces for odd values of n.
Therefore, we will consider the final state of a die roll to
be the side of the die touching the ground when it comes
to rest.
II.
FIG. 1: An ancient die from a Harappan period excavation
site in India (left), and a modern precision casino die (right).
Ancient die image reproduced from reference [3].
THEORY
The two dimensional dice will be uniform rigid bodies
with three degrees of freedom. Each die will be a thin
plate in the shape of a regular n-gon, circumscribed in
a circle with a radius R. As shown in Fig. 2, each ngon is formed of n isosceles triangles with the two equal
sides formed by the circumradii of the n-gon. The base
of the triangle is formed by one side of the n-gon, and
the altitude shown in Fig. 2 is formed by an apothem of
the n-gon. Each triangle has a vertex angle θ = 2π/n,
which gives the length of an apothem A for the n-gon to
be
A = R cos
π
n
,
(1)
2
ϕ
R
θ
r
y
A
ω
S
x
FIG. 2: A regular n-gon, with n = 6, where the apothem A,
circumradius R, side length S, and angle θ are labeled.
and the length of each side S is
π
,
S = 2R sin
n
B.
(2)
for a given circumradius R.
When developing the equations of motion for the die
and the collision model, we will make the common assumptions that air resistance is negligible, the walls and
floor are flat elastic surfaces, and only one corner of the
die may collide with a surface at a given time [1, 6].
A.
FIG. 3: The position of the die described by the coordinates
of its center of mass ~r and the die’s angle of rotation φ, where
ω is the angular velocity.
When a corner of the die comes in contact with the
horizontal table, or one of the vertical walls, the elastic
surface causes the die to rebound and the resulting angular and linear velocities can be determined. We will
consider a simple collision model [7, 8]. First a collision
with the table will be considered, and then the equations
will be extended to collisions with the walls. The new
velocity vy0 of the die in the y direction after the collision
is
vy0 = −β⊥ vy ,
Trajectory of the Die
The location and orientation of a two-dimensional nsided die are uniquely described by the x and y coordinates of the die’s center of mass, represented by the
vector ~r, and the angle of rotation φ, as shown in Fig. 3.
Since air resistance is neglected, the only force acting on
the die is gravity, and the equations governing the motion
of the die are
ax = 0,
ay = −g,
(3)
(4)
φ̈ = 0,
(5)
where g is the acceleration due to gravity. These equations can be integrated to find the position and orientation of the die as a function of time giving
x = x0 + vx0 t,
1
y = y0 + vy0 t − gt2 ,
2
φ = φ0 + ω0 t,
Collisions
(6)
(7)
(8)
where after each collision is resolved, the time t is reset
to zero and the values of x, vx , y, vy , φ, and ω become the
new initial conditions (x0 , vx0 , y0 , vy0 , φ0 , and ω0 ).
(9)
where β⊥ is the coefficient of normal restitution [7]. The
coefficient of normal restitution takes from 0 to 1, where
β⊥ = 0 corresponds to a surface with no rebound and
β⊥ = 1 corresponds to a perfect rebound with no loss of
energy in the y direction [9].
With a similar technique, we can find the new angular
velocity ω 0 and x velocity vx0 of the center of mass of the
die with
vx0 + Rω 0 = −βk (vx + Rω),
(10)
where βk is the coefficient of tangential restitution [7, 8,
10]. The coefficient of tangential restitution takes values
from -1 to 1. To conserve angular momentum for the die
at the point of contact,
I(ω 0 − ω) − M R(vx0 − vx ) = 0
(11)
where the M is the mass of the die and I = αM R2 is
the moment of inertia about the center of the die [8]. As
discussed in [7, 8], combining Equations 10 and 11 results
in
−1
(αβk − 1)vx + α(βk + 1)Rω ,
α+1
−1
ω0 =
(βk + 1)vx − Rω(α − βk ) ,
R(α + 1)
vx0 =
(12)
(13)
3
y
y
π/
n
x
dy
x/
2
FIG. 4: One of the n isosceles triangles that form a regular
n-gon divided into infinitesimal trapezoidal sections at a distance y from the axis of rotation (left) and the geometrical
relationship between the width of each section and y (right).
where vx0 and ω 0 are the velocities after the collision. For
a collision with a wall, the x velocity is updated with
Eq. 9, the y velocity is updated with Eq. 12, and vx is
replaced with vy in Eq. 13.
C.
The moment of a inertia about the center of mass of
a regular n-gon shaped plate with a circumradius R and
a uniformly distributed mass M can be determined by
finding the moment of inertia for the n isosceles triangles illustrated in Fig. 2. As shown in Fig. 4, each of
these isosceles triangles can be divided into infinitesimal
trapezoidal sections, which are approximated as rectangular plates with lengths of x and widths of dy. Each
rectangular plate with a mass of M0 has a moment of
inertia
1
M0 (x2 + dy 2 )
12
(14)
about an axis through its center of mass [11]. By the parallel axis theorem, the moment of inertia for each rectangular plate about the center of the n-gon is
Ir = Icm + M0 y 2 ,
(15)
where y is the distance from the plate’s center of mass to
the parallel axis of rotation at the vertex of the triangle
[11]. The mass of each rectangular plate is
M0 = σ(x · dy),
(16)
where σ is the uniform density of the die. Combining
Equations 14, 15, and 16, and taking dy 2 to be negligible,
gives the moment of inertia for each rectangular plate to
be
Ir =
1
σ(x · dy)x2 + σ(x · dy)y 2 .
12
Since the triangle has a uniform density,
2M4
σ=
,
(21)
SA
where M4 is the mass of the triangle. When Eq. 21 is
substituted into Eq. 20 and the expression is given in
terms of R and n from Equations 1 and 2,
π 1
π 1
+ cos2
.
(22)
I 4 = M4 R 2
sin2
6
n
2
n
To find the moment of inertia I for the n-gon, we may
simply multiply the moment of inertia for one of the
isosceles triangles by n, giving
Moment of Inertia
Icm =
Since the top angle of the triangle θ is 2π/n, as illustrated in Fig. 4, the width of the rectangular plate is
π
x = 2y tan
,
(18)
n
and substituting this into Eq. 17 gives
π
π 2
Ir =
σ tan3
y 3 dy + 2σ tan2
y 2 dy. (19)
3
n
n
Integrating Eq. 19 with respect to y along the entire
length of the apothem gives the moment of inertia of the
triangular plate about this vertex I4 to be
Z A
π A4 σ tan nπ
1
Ir =
I4 =
.
(20)
tan2
2
3
n
0
(17)
I = nI4 .
(23)
Since the total mass of the n-gon M is
M = n · M4 ,
(24)
the moment of inertia of a uniform thin plate in the shape
of a regular n-gon with circumradius R is
1
1
2 π
2
2 π
I = MR
sin
+ cos
.
(25)
6
n
2
n
Taking the limit of Eq. 25 as the number of sides goes
to infinity gives
π 1
π 1
1
lim M R2
sin2
+ cos2
= M R2 , (26)
n→∞
6
n
2
n
2
which is the moment of inertia for a solid cylinder [11].
III.
SIMULATION
A simulation modeling a two-dimensional die roll with
the given assumptions was written in Objective-C++,
and a graphical user interface was developed to allow for
automated data collection and visual verification of the
implementation. A sample run of the simulation is shown
in Fig. 5, and the Experiment window is shown in Fig. 6.
The sides of each die are numbered from 0 to n − 1,
with side 0 between the corners at φ0 and φ0 + 2π/n. As
shown in Fig. 7, the sides are numbered sequentially in a
counterclockwise manner. In the graphical display mode
of the simulation, side 0 is displayed in a different color
so that the user can better analyze the die’s motion.
4
TABLE I: Standard parameter values for many of the trials.
Variable
φ0
vx0
βk
β⊥
dt
R
FIG. 5: The graphics window for the Dice simulation.
Value
0
0 cm/s
-0.35
0.2
0.001 s
√
1.9/ 2 cm
ture felt-covered pool table and an Exilim HS-ZR100 digital camera shot high speed videos of the roll at 1000
frames per second. The center dot and a corner dot were
tracked with the video analysis feature in the PASCO
Capstone data acquisition program before and after a
collision. From over twenty data points for each tracked
dot before the first collision, and twelve data points after, βk was approximated to be −0.35 with Eq. 10 and
β⊥ was found to be about 0.2 with Eq. 9.
These coefficients depend on the physical properties
of both the die and the table. This experimentation was
conducted to give an appropriate range of realistic values
to use in the simulation, and more precise values could
be obtained to examine other realistic regions in the parameter space. As included in Table I, the time step
dt was set to 0.001 s√for the simulation and dice with a
circumradius of 1.9/ 2 cm were considered.
FIG. 6: The Experiment window for the Dice simulation.
IV.
A.
Coefficients
Appropriate values for the coefficients of restitution
were acquired through experimentation. Four casino
dice, like the modern die pictured in Fig. 1, were joined
together with double-sided tape to better match the twodimensionality of the model. The die, with the side of
three dots facing the camera, was tossed onto a minia-
0
1
ϕ0
n-1
2
...
FIG. 7: The side labels assigned by the simulation from 0 to
n − 1 for an initial orientation φ0 .
RESULTS AND ANALYSIS
With the Experiment window of the simulation, regions of the parameter space can be examined for chaotic
behavior. The drop height y0 and initial angular velocity ω0 were varied. For these tests, the die is given zero
velocity in the x and y directions, and it is released at
an angle φ0 = 0. Figure 8 shows the final state diagram
for the simulated roll of a 4-sided die. These results suggest nonlinear behavior, where basins of attraction, the
streaks of the same color in the graph, represent stable
regions in the parameter space. If a die is released with
initial conditions near the middle of one of these regions,
small adjustments to the initial drop height and angular
velocity will give the same outcome.
The curved shape of the basins of attraction in Fig. 8
matches our expectations, where dice released from
greater heights have more time to rotate in the air, which
makes them more sensitive to the initial angular velocity.
This general pattern is also found in three-dimensional
models [1, 9]. As the number of sides increases, the width
of the stable regions tends to decrease, and chaos begins
to appear within each region. Figure 9 illustrates this
change when n is increased to 20.
The orange band in the upper right corner of Fig. 10
shows that stable regions are present for larger values of
n. While initial conditions within this region lead to pre-
5
FIG. 8: The final state diagram for a die with four sides where
red is used for side for 0, green for 1, cyan for 2, and violet
for 3. The parameters are listed in Table I.
FIG. 10: The boxed region from Fig. 9 with increased resolution and the same color scheme.
FIG. 9: A final state diagram for n = 20 with the parameters
from Table I and a rainbow color scheme from red (side 0) to
violet (side 19).
FIG. 11: A final state diagram for a 5-sided die depending on
the initial drop height and x velocity, with ω0 = 0 and the
other parameters coming from Table I. The rainbow color
scheme goes from red (side 0) to violet (side 4).
dictable results, other regions of Fig. 10 illustrate chaotic
behavior. Before determining whether this behavior is
random, the definition of randomness must be reconsidered. While the sensitivity to initial conditions found in
Fig. 10 is likely beyond the control of humans, and possibly machines, the color scheme in Fig. 9 accentuates that
the final state within each streak alternates among just
a few adjacent sides. If the goal is to always land on a
certain side, these regions can be considered random, but
if the goal is to land within a range of outcomes, these
regions cannot be considered truly random.
A.
Wall Collisions
Simulating walls on either side of the table extends previous die throwing models and addresses whether throwing a die against a wall actually decreases the control
one has on the die roll. The final outcomes of the die
rolls will be examined for varying drop heights and initial velocities, with an initial angular velocity of zero.
Figures 11 and 12 are final state diagrams for a 5-sided
die with no vertical boundaries, while Fig. 13 considers
walls separated by 20 cm.
When walls are not considered, Figures 11 and 12 show
regions of stability with chaotic regions along the boundaries. Within these chaotic regions, fractal patterns such
as those in Fig 12 are present [2]. Contrary to expectations, Fig. 13 indicates that the walls may actually decrease the system’s sensitivity to initial conditions. In
Fig. 11, the die does not land on side 3, which is the side
that initially collides with the table (since ω0 = 0), although the die lands on this side in Fig. 13. With these
parameters, side 0 (represented in red) is rarely the outcome and the boundaries between basins of attraction
6
are more well-defined than in Fig. 11.
V.
FIG. 12: The boxed region from Fig. 11 with an increased
resolution and the same color scheme.
These findings suggest that rolling a die is not a truly
random process, yet for some initial conditions, the precision necessary to control the outcome likely exceeds
human ability. As the number of sides increases, the
stable regions become smaller, and additional chaotic regions are observed. Even as n increases, stable regions
are present, and in the chaotic regions, the final state is
typically drawn from a few adjacent sides. As expected,
the initial angular velocity is shown to have an increased
effect on the outcome of system at greater drop heights.
The addition of walls to this model allows us to see
whether the degree of control over the system increases
or decreases with these constraints. For this region of
the parameter space, walls actually reduced the chaotic
behavior at boundaries between stable regions. It is important to note that the walls in this simulation are considered to be flat surfaces with the same properties as
the floor, and these patterns may not extend to dice
games with non-homogeneous walls. The simulation explores the relationship between chaos and chance in a
two-dimensional die roll. Future directions for this research include investigating new regions of the parameter space and extending the model into three-dimensions.
Unless our definition of randomness is changed, the nonlinear behavior of a die roll cannot be considered a truly
random process
VI.
FIG. 13: A final state diagram for a 5-sided die with vertical
walls 20 cm apart. The outcome depends on the initial drop
height and initial x velocity, with ω0 = 0 and the other parameters from Table I. The rainbow color scheme goes from
red (side 0) to violet (side 4).
[1] J. Strzalko, J. Grabski, P. Perlikowski, A. Stefaski, and
T. Kapitaniak, Dynamics of Gambling: Origins of Randomness in Mechanical Systems, Springer, (2009).
[2] T. Tél and M. Gruiz, Chaotic Dynamics: An Introduction Based on Classical Mechanics, Cambridge University
Press, (2006).
[3] Image reproduced from the wiki site Veda article
Sports and Games in Ancient India,
(http://veda.wikidot.com/info:origin-of-games),
Creative Commons Attribution-ShareAlike 3.0 License,
(http://creativecommons.org/licenses/by-sa/3.0/),
cropped from the original image, (accessed April 2014).
[4] J. Ford, Phys. Today, 36 (4), 40 (1983).
[5] J. Nagler and P. Richter, Phys. Rev. A, 78 (3), 036207
(2008).
CONCLUSIONS
ACKNOWLEDGMENTS
I would like to thank Dr. Susan Lehman and Dr. John
Lindner for their help and support throughout the
project. I would also like to thank the College of Wooster
Physics Department for providing the resources and facilities for this project and Kazuki Kyotani for assisting
me with capturing die rolls on the high speed camera.
[6] R. Feldberg, M. Szymkat, C. Knudsen, and E. Mosekilde,
Phys. Rev. A, 42 (8), 4493 (2010).
[7] Brian T. Hefner, Am. J. Phys., 72 (7), 875 (2004).
[8] W. Goldsmith, Impact: The Theory and Physical Behaviour of Colliding Solids, Edward Arnold (Publishers)
LTD., (1960).
[9] M. Kapitaniak, J. Strzalko, J. Grabski, and T. Kapitaniak, Chaos, 22 (4), 047504 (2012).
[10] J. T. Jenkins and M. W. Richman, Phys. Fluids, 28 (12),
3485 (1985).
[11] H. D. Young and R. A. Freedman, University Physics
with Modern Physics, 13th Edition, Addison Wesley,
(2012).