Galilean Cannon

Enter the relative mass
of the lower ball
Then press the button

There are two impacts that we have to model.
First is the bounce of the lower, heavier ball on the table. Its velocity is reversed, with a factor of .9 multiplying it as a coefficient of restitution. This happens whenever its position is below the table contact position and it is moving downwards.

Next is the impact between the balls.

If we take the mass of the light ball as 1, the mass of the heavy ball will be mratio*1. To conserve momentum we must change the velocities by subtracting the velocity
  vclose * kheavy
from the heavy ball and adding velocity
  vclose * kheavy * mratio
to the light one. But what is the value of kheavy?

If we assume a 'perfect bounce' with a coefficient of restitution of 1.0, the parting velocity will be equal (and opposite) to the closing velocity. So the change will be twice the closing velocity, so
  kheavy(1 + mratio) = 2
But if we assume a coefficient of restitution of .9 we have
  kheavy(1 + mratio) = 1.9
i.e.
  kheavy = 1.9 / (1 + mratio)