BallsBounce app

Link to the BallsBounce app on iTunes

Using the BallsBounce app, you can place between 1 and 50 balls on the screen and watch them as they move around, bouncing off the sides and colliding with one another. Here's a typical screenshot of the application, on the left below.

Also shown, on the right above, is the settings screen, which you get to by pressing the info (i) button on the main screen. Via the settings, you can set the number of balls, their size, the temperature (this sets the speed of the balls - they move faster when the temperature is higher, and they move in slow motion when the temperature is lowest), as well as whether or not the balls collide with one another.

You can also adjust the color of the balls. Ball 1 is the ball that is drawn on top of the others, and you set its color separately so you can make it stand out from the rest. You set the R (red), G (green), and B (blue) components of the color using the sliders. There is another set of sliders to set the color of all the other balls. They are all the same color, unless the "use random colors" switch is set to ON, in which case the colors are different. In other words, the "use random colors" switch over-rides the R, G, and B sliders for the other balls.

Although the app can be fun to watch, it can also be used to examine some basic physics. Some of the concepts that can be investigated are shown below.
ConceptScreenshot
1. The ideal gas law
An ideal gas involves a whole bunch of identical particles bouncing around, with the total volume of the particles themselves being negligible in comparison to the volume of the box they are confined to. Thus, use the maximum number of balls, and set the ball size to a small value. If you don't allow them to collide with one another, each ball will maintain its speed - allowing them to collide means that they will exchange momentum with one another via collisions. Use the random colors, or turn the random colors off and just have ball 1 a different color than the others.
2. Color mixing with light
There are a couple of ways to use the ball bounce app to do color mixing with light. To begin with, you can set the number of balls to 1, and then adjust the R, G, and B sliders for ball 1 to see what color is produced. What do the sliders have to be set to to make white, or black, or yellow, or orange, or purple, for instance? The second way is shown in the picture, in which there are multiple balls, and both of the transparency sliders are set to about 0.6 (feel free to play with this, of course), and the "collisions" switch is turned off. When the balls overlap, because they are semi-transparent, the colors add together in an interesting way in the regions of overlap.
3. Elastic collisions in two dimensions
For this, the collisions switch must be set to ON. Use as few as two balls, turning the ball size way up to increase the likelihood of collisions. In the app, the collisions are all elastic, so the total kinetic energy of two balls is the same before and after they collide with one another, but the collision can transfer energy and momentum from one ball to the other. Now, sit back and watch as the balls collide - don't forget that you can watch in slow motion if you turn the temperature slider way down.
4. Brownian motion
The app does not exactly do classic Brownian motion, but it gets the idea across. Here, use 10-15 balls, with the ball size slider set to something like 20-30 pixels. The "collisions" switch must be set to ON. At first, you can see all the other balls collising with ball 1, and making it move randomly around the screen. However, if you set the Transparency slider for the other balls to zero (the ball 1 Transparency slider should be 1, or at least non-zero!), you won't be able to see the other balls, and ball 1 will move randomly around the screen for no apparent reason. We know why, of course.
Stay tuned for a picture
5. Phase transitions
Crank the number of balls up to 50, and then adjust the ball size to something relatively large. The collisions switch should be ON here. See what you get. If you turn the "random colors" switch to OFF, you can get something like what is shown in the picture at right. See if you notice any crystal structures forming. Here's a challenge for you - see if you can find a ball radius such that at high temperatures you get fluid-like behavior, and at low temperatures it is solid-like. Then, see if you can find another ball radius such that at high temperatures you get gas-like behavior, and at low temperatures it is fluid-like.

By the way, if you are an educator or a student who can't afford the 99 cents it costs to buy the app, drop me a line at Prof.Duffy at gmail.com. I should be able to get codes for 50 free downloads from Apple and, assuming I have some left, I'll send you a code for a free download.

This web page was first posted on August 19, 2009.

Last update: October 2, 2009.

Note: this app was submitted to the app store on August 18, 2009, and was approved for sale on August 29, 2009.