This following applet is [b] Fall and Rebound[/b]
Created by prof Hwang Modified by Ahmed
Original project [url=http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1814.0]Fall and Rebound[/url]

Fall and Rebound
How do we simulate a (free) falling object?
Well, the answer, in principle, is rather simple: just solve the equation y'' = -g, where g is gravity.
And this works, perfectly well... except when the object reaches the ground. Then, we would expect the object to rebound.
When rebounding, the object changes instantly its velocity from downwards (negative) to upwards (positive). If the rebounding is perfectly elastic, then the object's velocity remains constant in modulus.
But, how would you implement this in a simulation?
This example shows two possible approaches to solve this problem.
The first one uses the closed form solution of the equations for the movement. It is fast, clean and efficient. But implies that we know the solution. In other, more complicated situations, we might not be able to solve these equations. For instance, if there is an external variable force applied to the falling object.
The second approach implies fine-tuning the way we solve numerically the second order differential equation at every moment. When the object comes closer to the ground, we ask the method to use a smaller time step. This provides a more accurate computation of the velocity the object had when reaching the ground.
The disadvantage is that the simulation seems to run slower at the critical moment. We try to compensate this, by asking Ejs to run faster!
Author : Francisco Esquembre

From an original idea from Taiwan Workshop on Ejs Date : March 2002

Click [eye]

/htdocs/ntnujava/ejsuser/37048/users/br/ahmed/FallAndRebound_pkg/FallAndRebound.propertiesFull screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Download EJS jar file(1449.9kB):double click downloaded file to run it. , Download EJS source View EJS source  