Chapter 4. Physics of a Falling and Bouncing Ball [First Draft CBPrice October 3rd 2011] [Rev.1 Jan 21st 2012] A Falling Ball When a ball is released from rest it falls, due to the pull (force) of gravity on the ball, as shown in figure 1. We wish to write a simulation program to investigate falling balls; to do this we must start with the physics description of the situation, then we must relate this to a simulation algorithm, and finally we must write some simulation code. The following steps will lead you through this process which will be useful for many future simulations. First we start with the physics. Remember that to calculate position we need speed, and to calculate speed we need acceleration. How do we calculate acceleration? Well we need to use Newtonian Physics which relates force to acceleration. Newtonian Physics tells us that the value of the force F on the ball is given by the expression 𝐹 = −𝑚𝑔 (1) where m is the mass of the ball and g is the gravitational acceleration on the planet. For Earth this is 9.81 m/s/s, on the Moon it is one sixth of this. Note the minus sign in (1). This tells us that gravity is acting downwards in the opposite direction to the vertical position of the ball which is measured from the ground upwards. Newtonian physics also tells us how to calculate acceleration from the actual force. This is done using the expression 𝐹 𝑎=𝑚 (2) Plugging the first expression into the second, we find that acceleration is given by a = -g It could not be simpler! Now we need to know how to use acceleration to calculate the speed change, this is given by the expression 𝑎= 𝑑𝑣 𝑑𝑡 (3) and finally how to use the speed to calculate the position change. This is given by the expression 𝑣= 𝑑𝑧 𝑑𝑡 (4) Now we must convert these expressions into simulation code. Let’s work down the four expressions. (1) is simple. We could write forceZ = -1.0*mmass*gravity; (2) is also simple. We could write accelZ = forceZ/mmass; (3) Here we choose the Euler algorithm and so we would re-arrange the expression and use the “delta” approximation and so obtain i.e. ∆𝑣 = 𝑎∆𝑡 𝑣 ′ = 𝑣 + 𝑎∆𝑡 which we could code as velyZ += accelZ*dT; (4) Again using the Euler approximation we would write i.e. ∆𝑧 = 𝑣∆𝑡 𝑧 ′ = 𝑧 + 𝑣∆𝑡 which we could code as dispZ += velyZ*dT; That completes the transformation from the conceptual (physics) model to the computer code. The complete function to effect the Euler simulation is shown below, function computation(float dT) { local float forceZ; local float accelZ; forceZ = -1.0*mmass*gravity; accelZ = forceZ/mmass; velyZ += accelZ*dT; dispZ += velyZ*dT; time += dT; } When the Ball Bounces Let’s think of a tennis ball which is released from a certain height with no initial speed. In other words, you hold the ball in your hand and let it fall. It moves vertically downwards and hits the ground, then it bounces back up. As expected it rises to a height less than its initial height, then it falls and bounces again. After each bounce we expect it to rise to a smaller height each time. Here’s a typical graph of its height plotted against time recorded from a real simulation and plotted in Excel. 12 dispZ 10 8 6 4 2 0 0 2 4 6 8 10 The physics of bouncing is quite straightforward, well maybe. When the ball approaches the ground it has a certain velocity v which is downwards. After the collision with the ground, its velocity is changed in two ways. First, its direction is inverted (the ball is now moving upwards) so the sign of the velocity is reversed. So we could write velyZ = -velyZ where the ‘-‘ sign indicates the change in direction. Second, the rebound velocity will normally be less than the velocity before the impact. This makes sense, since during the impact the ball may lose energy and so it will lose some velocity during the impact. This loss of velocity is described using the coefficient of restitution e, which relates the velocity before and after the collision. The values of e in the physical world lie between 0 and 1 (though you are free to try out values outside this range in your simulations. vely = -e*vely; After the collision, the ball will move with this smaller inverted velocity under the influence of gravity and will fall to a smaller height when e is less than one. In the figure plotted above e had been set to 0.7070707 which has been chosen so that the height of the ball is halved following each bounce. Looking at the above plot, we can ask two interesting questions. The first is “At what time does the ball stop bouncing?” and the second is “How many bounces does the ball make?” Since the ball loses half of its height at each bounce then the height after four bounces will be 1 1 1 1 1 2 2 2 2 16 . . . = of its original height. After n bounces the ball’s height will be 1 (5) 2𝑛 of its original height (that means a half times itself n times). So you can see that the height of the ball never reaches zero, unless we consider n to be infinitely large in which case expression (5) is zero. So this answers the second question, the ball makes an infinite number of bounces before it comes to rest. Now let’s turn to the first question. Since the ball makes an infinite number of bounces, then it seems logical that it needs an infinite time to stop bouncing. While this seems a reasonable idea it is incorrect. Since the height of the ball is decreasing with each bounce, the time taken for each bounce is also decreasing. So perhaps the ball stops bouncing in a finite time? The answer lies in summing up the times for all the bounces the ball makes, an infinite number. When you do this, you get the result 2ℎ (1+𝑒) 𝑇∞ = √ 𝑔 (1−𝑒) where 𝑇∞ is the time for an infinite number of bounces, h is the initial height of the ball, g is the value of gravity and e is the coefficient of restitution. Plugging in the values used to generate the figure shown above, we find that 𝑇∞ = 7.93 secs, which agrees with the figure. The result is interesting. The ball makes an infinite number of bounces in a finite time. This is an example of a whole series of problems related to ‘Zeno’s Paradox’. You may wish to investigate!