\documentclass[12pt]{amsart}


\usepackage{graphicx}

\usepackage{hyperref}
\hypersetup{colorlinks=true, linkcolor=blue, citecolor=blue}

\pagestyle{empty}

\begin{document}

\title{\bf{Bouncing Balls}}
\maketitle

\thispagestyle{empty}

\begin{center}
Alex Jing Wei Huang

Department of Mathematics

alexhuang3000@hotmail.com
\end{center}

\begin{verbatim}





\end{verbatim}

\section{Abstract}
Suppose a set of balls is moving inside a container with certain size. What is the collision rate of these balls? In this paper, we analyze the collision rate of these balls under different conditions. The main goal of this project is to find out how the collision rate is changed if we vary some parameters of the system, such as the number of balls, the size of the container, and the initial velocity range of balls. We also explore the velocity distribution of these balls.
\clearpage 

\section{Introduction}
Objects and particles are moving in the universe. They collide and react with each other. How often do they collide? Will the earth collide with other planets and rocks in the unverse? It is interesting to find out the collision rate of planets and other objects in the universe. It is also interesting to discover how the collision rate is changed under certain conditions. We answer these questions by analyzing the behaviors of moving balls inside a bounded region. 


\section{Background}
We use a computer program to simulate the bouncing balls system. For simplicity, we will assume that balls are moving in a two dimensional space and has random initial velocities from certain range. We also assume that energy and momentum are conserved before and after these balls collide. So their velocities after collisions are determined by the laws of conservation of momentum and energy.
\begin{equation}
M_1V_{1, init} + M_2V_{2, init} = M_1V_{1, fin} + M_2V_{2, fin}
\end{equation}
\begin{equation}
\frac{M_1V_{1,init}^2}{2} + \frac{M_2V_{1,initn}^2}{2} = \frac{M_1V_{1,fin}^2}{2} + \frac{M_2V_{1,fin}^2}{2}
\end{equation}
where $M_i$ is mass, $V_{i,init}$ is the the velocity before the collision, and $V_{i,fin}$ is the velocity after the collision.

Note that we assume the balls have same mass, and so the second equation is reduced to 
\begin{equation}
\frac{V_{1,init}^2}{2} + \frac{V_{1,initn}^2}{2} = \frac{V_{1,fin}^2}{2} + \frac{V_{1,fin}^2}{2}
\end{equation}

The complete algorithm for calculating the velocities of particles will be discusse in next section. 


\section{Dynamical system}

\subsection{States space and parameters of the system}
In our simulation, since balls are moving in two dimensional space with initial velocity, the state space of these balls is 4 dimension, which are the position states (x and y coordinates) and the velocity states (x and y directions). Other paramester of the system are the container size (width and hight), the radius of balls, and the mass fo balls. For simplicity, all balls have same radius and mass in our simulation.

\subsection{Algorithm}
Since we assume that the particles have nonzero radius r, the algorithm for computing velocities of balls after collision is a little complicated. The moving directions of balls after collision are determined by their collision point where two balls touch each other. Suppose the position is represented by the vector $(x, y)$, then their collision point is given by $(\frac{x_2 + x_1}{2}, \frac{y_2 + y_1}{2})$.

Let the vector (vx, vy) represents the velocity of a ball. To calculate the moving directions of two balls after they collided, we need to compute their relative velocity angle $RVA$ which is given by
\begin{equation}
RVA = atan(\frac{vy_{1,init} - vy_{2,init}}{vx_{1,init} - vx_{2,init}}),
\end{equation}
and their relative position angle $RPA$ which is given by
\begin{equation}
RPA = atan(\frac{y_2 - y_1}{x_2 - x_1}).
\end{equation}
We also need to compute the impact parameter $IP$ which is given by 
\begin{equation}
IP = d*sin(\frac{RPA - RVA}{r_2 - r_1}), 
\end{equation}
where $d$ is he distance bwtween two particles. And so the impact angle is obtained by 
\begin{equation}
IA = asin(IP)
\end{equation}
With the values of RVA, RPA and IP computed above, we can compute the final velocities and directions of balls. Let's first define $dv$ by 
\begin{equation}
dv = -2\frac{(vx_{2,init} - vx_{1,init}) + (vy_{2,init} - vy_{1,init})tan(RVA + IA)}{(1 + tan^2(RVA + IA))(1 + M_2 - M_1)},
\end{equation}
where $vx_{i,init}$ and $vy_{i,init}$ denotes the x and y velocity components of the $i$ ball. Then the resulting velocity vectors $(vx_{1,fin}, vy_{1,fin})$ and $(vx_{2,fin}, vy_{2,fin})$ of two balls after the collision is computed as follow:
\begin{equation}
vx_{1,fin} = vx_{1,init} - (M_2 - M_1) * dv,
\end{equation}
\begin{equation}
vy_{1,fin} = vy_{1,init} - tan(RVA + IA) * (M_2 - M_1) * dv,
\end{equation}
\begin{equation}
vx_{2,fin} = vx_{2,init} + dv,
\end{equation}
\begin{equation}
vy_{2,fin} = vy_{2,init} + tan(RVA + IA) * dv.
\end{equation}







\section{Method}
To analyze how the collision rate is changed with respect to different parameters (such as container shape, number of balls in container and initial velocity range), we perform three experiments. In the first experiment, we vary the container size to see how the collision rate is affected. Similarly, in the second and third experiment, we vary the number of balls and the inital velocity range, respectively, to see how these parameters affect the collision rate.


In the first experiment, we put 10 balls in three containers with sizes $600$ x $600$, $900$ x $400$, and $1200$ x $300$ respectively. These balls have random initial velocities (in each x and y direction) from the range [-5, 5]. Note that, in our simulation, the unit of distance is pixel and the unit of velocity is pixel per iteration. Also note that these three containers have same area but different shapes. Figure \ref{windows} shows their relative sizes. We let these balls move and collide inside the each container for one day (24*60*60 iterations) and compute the numbers of ball-to-wall and ball-to-ball collisions.

\begin{figure}
\begin{center}
\includegraphics[scale=0.4]{windows.jpg}
\caption{Three containers that we use for the first experiment.}
\label{windows}
\end{center}
\end{figure}

In the second experiment, we fix the container size to be $600$ x $600$ and put different numbers of balls in the container. We firstput $10$ balls in the container, then put $15$ balls, and finally put $20$ balls. Like the first experiement, The initial velocity range is [-5, 5]. Again we let the balls move and collide for a day and compute the numbers of ball-to-wall and ball-to-ball collisions.

In the third experiment, we fix the window size and number of balls to be $600$ x $600$ and $10$, and choose three different initial velocity ranges, which are $[-10, 10], [-15, 15], and [-20,20]$. We then compute the numbers of collisions after moving for one day. 

\section{Results and Conclusions}
To get a more accurate result, we perfrom the three experiements described above five times and compute the average results. The results of the first experiement are listed in Table \ref{ex1_1}, Table \ref{ex1_2}, and Table \ref{ex1_3}. We summaryize the results of the first experiment in Table \ref{ex1_4}. From Table \ref{ex1_4}, we see that as the ratio of the height and width of the window increase from $1$ to $4$, the number of ball-to-wall collisions increases, the number of ball-to-ball collisions decreases, and the totall collisions increases. We conclude immediately that we can minimize the number of ball-t0-wall collisions by putting balls in a square container or reduce the number of ball-to-ball colisions by putting balls in a rectangular container.

\begin{table}
\caption{Results from the first experiment with $10$ balls, velocity range $[-5,5]$, and window size $600$ x $600$}
\begin{center}
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
 & Data 1 & Data 2 & Data 3 & Data 4 & Data 5 & Average \\
\hline
Ball to wall & 8373 & 8565 & 7114 & 7471 & 5755 & 7455.6 \\
\hline
Ball to ball & 9673 & 6905 & 7186 & 5357 & 4387 & 6721.6 \\
\hline
Total & & & & & & 14177.2\\
\hline
\end{tabular}
\end{center}
\label{ex1_1}
\end{table}


\begin{table}
\caption{Results from the first experiment with $10$ balls, velocity range $[-5,5]$, and window size $900$ x $400$}
\begin{center}
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
 & Data 1 & Data 2 & Data 3 & Data 4 & Data 5 & Average \\
\hline
Ball to wall & 9032 & 7903 & 7539 & 9442 & 6929 & 8169 \\
\hline
Ball to ball & 6543 & 5165 & 8268 & 6768 & 4457 & 6240.2 \\
\hline
Total & & & & & & 14409.2\\
\hline
\end{tabular}
\end{center}
\label{ex1_2}
\end{table}


\begin{table}
\caption{Results from the first experiment with $10$ balls, velocity range $[-5,5]$, and window size $1200$ x $300$}
\begin{center}
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
 & Data 1 & Data 2 & Data 3 & Data 4 & Data 5 & Average \\
\hline
Ball to wall & 10409 & 10688 & 9323 & 9696 & 10400 & 10103.2 \\
\hline
Ball to ball & 5840 & 6205 & 4710 & 6264 & 5914 & 5786.6 \\
\hline
Total & & & & & & 15889.8\\
\hline
\end{tabular}
\end{center}
\label{ex1_3}
\end{table}


\begin{table}
\caption{Result summary of the first experiment}
\begin{center}
\begin{tabular}{|l|l|l|l|}
\hline
 & 600 x 600 & 900 x 400 & 1200 x 300 \\
\hline
Ball to wall & 7455.6 & 8109 & 10103.2 \\
\hline
Ball to ball & 6721.6 & 6240.2 & 5786.6 \\
\hline
Total & 14177.2 & 14409.2 & 15889.8 \\
\hline
\end{tabular}
\end{center}
\label{ex1_4}
\end{table}


The results of the second experiment are listed in Table \ref{ex2_1}, Table \ref{ex2_2}, and Table \ref{ex2_3}. We summaryize the results from the second experiment in Table \ref{ex2_4}. Table \ref{ex2_4} shows that as we double the number of balls, the number of ball-to-wall collisions is approximately doubled. We see that the number of ball-to-wall collisions is proportional to the number of balls in the container. Notices that the ball-t0-ball collisions is increased about three times when we double the number of balls. So the number of ball-to-ball collision is greatly impact by the number of balls in the simulation. 


\begin{table}
\caption{Results from the second experiment with $10$ balls, velocity range $[-5,5]$, and window size $600$ x $600$}
\begin{center}
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
 & Data 1 & Data 2 & Data 3 & Data 4 & Data 5 & Average \\
\hline
Ball to wall & 8373 & 8565 & 7114 & 7471 & 5755 & 7455.6 \\
\hline
Ball to ball & 9673 & 6905 & 7186 & 5357 & 4387 & 6721.6 \\
\hline
Total & & & & & & 14177.2\\
\hline
\end{tabular}
\end{center}
\label{ex2_1}
\end{table}


\begin{table}
\caption{Results from the second experiment with $15$ balls, velocity range $[-5,5]$, and window size $600$ x $600$}
\begin{center}
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
 & Data 1 & Data 2 & Data 3 & Data 4 & Data 5 & Average \\
\hline
Ball to wall & 10709 & 11188 & 12681 & 11876 & 11753 & 11641.4 \\
\hline
Ball to ball & 13004 & 13756 & 14361 & 13929 & 13834 & 13776.8 \\
\hline
Total & & & & & & 25418.2\\
\hline
\end{tabular}
\end{center}
\label{ex2_2}
\end{table}


\begin{table}
\caption{Results from the second experiment with $20$ balls, velocity range $[-5,5]$, and window size $600$ x $600$}
\begin{center}
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
 & Data 1 & Data 2 & Data 3 & Data 4 & Data 5 & Average \\
\hline
Ball to wall & 15023 & 17600 & 15865 & 18095 & 13209 & 15958.4 \\
\hline
Ball to ball & 22672 & 29090 & 25182 & 29167 & 22140 & 25614.2 \\
\hline
Total & & & & & & 41599.6\\
\hline
\end{tabular}
\end{center}
\label{ex2_3}
\end{table}


\begin{table}
\caption{Result summary of the second experiment}
\begin{center}
\begin{tabular}{|l|l|l|l|}
\hline
 & 10 balls & 15 balls & 20 balls \\
\hline
Ball to wall & 7455.6 & 11641.4 & 15958.4 \\
\hline
Ball to ball & 6721.6 & 113776.8 & 25641.2 \\
\hline
Total & 14177.2 & 25418.2 & 41599.6 \\
\hline
\end{tabular}
\end{center}
\label{ex2_4}
\end{table}


The results of the third experiement are listed in Table \ref{ex3_1}, Table \ref{ex3_2}, and Table \ref{ex3_3}. We summaryize the results from the thrid experiment in Table \ref{ex3_4}. Table \ref{ex3_4} indicates that both ball-to-wall and ball-t0-ball increase as the initial velocity range changes from $[-5, 5]$, to $[-10, 10]$, and to $[-15, 15]$. 



\begin{table}
\caption{Results from the third experiment with $10$ balls, velocity range $[-5,5]$, and window size $600$ x $600$}
\begin{center}
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
 & Data 1 & Data 2 & Data 3 & Data 4 & Data 5 & Average \\
\hline
Ball to wall & 8373 & 8565 & 7114 & 7471 & 5755 & 7455.6 \\
\hline
Ball to ball & 9673 & 6905 & 7186 & 5357 & 4387 & 6721.6 \\
\hline
Total & & & & & & 14177.2\\
\hline
\end{tabular}
\end{center}
\label{ex3_1}
\end{table}


\begin{table}
\caption{Results from the third experiment with $10$ balls, velocity range $[-10,10]$, and window size $600$ x $600$}
\begin{center}
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
 & Data 1 & Data 2 & Data 3 & Data 4 & Data 5 & Average \\
\hline
Ball to wall & 12593 & 13801 & 13514 & 14209 & 16859 & 14195.2 \\
\hline
Ball to ball & 11418 & 11176 & 10218 & 11809 & 12878 & 11499.8 \\
\hline
Total & & & & & & 25695.0\\
\hline
\end{tabular}
\end{center}
\label{ex3_2}
\end{table}


\begin{table}
\caption{Results from the third experiment with $10$ balls, velocity range $[-15,15]$, and window size $600$ x $600$}
\begin{center}
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
 & Data 1 & Data 2 & Data 3 & Data 4 & Data 5 & Average \\
\hline
Ball to wall & 17701 & 23766 & 21139 & 17312 & 22281 & 20439.8 \\
\hline
Ball to ball & 13301 & 17173 & 14962 & 13830 & 16048 & 15062.8 \\
\hline
Total & & & & & & 35502.6\\
\hline
\end{tabular}
\end{center}
\label{ex3_3}
\end{table}


\begin{table}
\caption{Result summary of the third experiment}
\begin{center}
\begin{tabular}{|l|l|l|l|}
\hline
 & [-5, 5] & [-10, 10] & [-15, 15] \\
\hline
Ball to wall & 7455.6 & 14195.2 & 20439.8 \\
\hline
Ball to ball & 6721.6 & 11499.8 & 15062.8 \\
\hline
Total & 14177.2 & 25695.0 & 35502.6 \\
\hline
\end{tabular}
\end{center}
\label{ex3_4}
\end{table}

Other than counting the number of collision, out simulation progarm also plots the histogram of velocities of the balls at every time step. The simulation verifies that the velocities of these balls has Boltzmann distribution, see figure \ref{histogram}.


\begin{figure}
\begin{center}
\includegraphics[scale=0.4]{histogram.jpg}
\caption{These balls' velocities have Boltzmann distribution}
\label{histogram}
\end{center}
\end{figure}


\section{References}
Thomas Smid, "Theoretical Principles of Plasma Physics and Atomic Physics", http://www.plasmaphysics.org.uk/


\end{document}