The coefficient of restitution of a ball is a number between…
The coefficient of restitution of a ball is a number between 0 and 1. This number specifies how much energy is conserved when the ball hits a rigid surface. A coefficient of .9, for example, means a bouncing ball will rise to 90% of its previous height after each bounce. If you drop the ball from an initial height of 10 meters, it will rise to 9 meters (10 * .9) on the first bounce, 8.1 meters (9 * .9) on the second bounce, 7.29 meters (8.1 * .9) on the 3rd bounce, and so on. Write a function named simulate_bounce that accepts 3 arguments: a coefficient, an initial height hi (in integer meters), and a threshold height ht (in integer cm). Your function should use a loop to calculate and return a tuple containing: The number of bounces until the ball rises to a height less than ht. The total distance traveled by the ball (in meters). Note that the final rise and fall of the ball (to the height less than ht) is not counted in this distance: In [1]: simulate_bounce(0.21, 10, 57) Out[1]: (2, 14.2) In [2]: simulate_bounce(0.6, 2, 18) Out[2]: (5, 7.2223999999999995) In [3]: simulate_bounce(0.49, 7, 43) Out[3]: (4, 18.868485999999997)
Read Details