You can add the bouncing behavior using a mirroring method, where we relax the system and instead of bouncing the ball one changes the sign of the potential. It can be written as $H=\frac{p^2}{2m}+mg|y|$ where $|y|=y$ if $y>=0$ and $|y|=-y$ if $y<0$. Equation of motion becomes $\ddot y(t)=-mg\,sgn(y)$, where $sgn(y)$ is the sign function of y (a Heaviside-theta-like function). To allow equlilibrium at $y=0$ to exist, we can define $sgn(0)\equiv0$. Writing this in Wolfram Alpha ([here][1], where $m=1$ and $q=gy$ for simplicity) gives the following graphs related to explicit solution $y(t)$ and phase diagram trajectories: [![][2]][2] Inserting the [Hamiltonian explicitly][3] gives a better look at phase space appearance [![][4]][4] Explicit solution to $y(t)$ has an iterative character but in essence is similar to the free-fall solution: $y(t)=y_0+v_0t-\frac12sgn(y)t^2$. And, finally, to recover the *actual* bouncing ball behavior just take the absolute value of $y(t)$, $|y(t)|$. [1]: https://www.wolframalpha.com/input/?i2d=true&i=D%5Bq%2C%7Bt%2C2%7D%5D%3D-sgn%28q%29 [2]: https://i.sstatic.net/VW1Zw.gif [3]: https://www.wolframalpha.com/input/?i2d=true&i=plot+H%3DPower%5Bp%2C+2%5D%2B%7Cq%7C [4]: https://www4b.wolframalpha.com/Calculate/MSP/MSP55481c9hbc272g7e27b200003cd16129586gc541?MSPStoreType=image/gif&s=31