# Question:How to model a bouncing ball through event handling?

## Question:How to model a bouncing ball through event handling?

Maple

I wish to model the motion of a ball that bounces up and down in a vertical line, and whenever it hits the ground, it bounces back with only a fraction of the collision speed.

We expect that the amplitude of the consecutive bounces to diminish and for all practical purposes the ball to come to a standstill.  It's not difficult to calculate the motion analytically by hand.

However, when I attempted to solve the equation of motion numerically with Maple's dsolve()  and event handling, I ran into a problem.  As the amplitude of the bounces approaches zero, numerical noise sets in and the ball tunnels itself underground!  See the worksheet below.

I don't know how to prevent the ball from going underground.  Any ideas?

 > restart;
 > de := diff(y(t),t,t)=-1;

 > ic := y(0)=1, D(y)(0)=0;

 > Events := [y(t)=0, diff(y(t),t)=-0.5*diff(y(t),t)];

 > dsol := dsolve({de, ic}, numeric,                  events=[Events], range=0..5);

 > plots[odeplot](dsol, thickness=3, color=red);