Body sliding on a surface

For a body sliding on a surface η(x), under gravity g in the x direction, the equation of motion is:

Body on surface formula

It is surprisingly difficult to derive this equation and it is also not easy to find in a book. We derived it using Hamilton's principle and have not seen another derivation. For this reason the solution presented here can been seen as a check since the solution conserves energy.

How can we see the system conserves energy? Because the ball rises to nearly the same height as it started with. There is a slight difference between the end height and the start height, due to numerical errors in the solution we implemented. More sophisticated methods to solve the equation could use the conservation of energy to improve their accuracy.

Information

Clicking anywhere on the trail will place the body at that point, where gravity will take over.

Many thanks go to Dr Mike Meylan, lecturer in mathematics at The University of Auckland for his amazing ability to understand seemingly meaningless squiggles representing the workings behind this, after a pizza and a few beers. Drinking and deriving isn't so bad after all ;o)

Written for the Ozone Asylum September 2004 20-line JavaScript competition
Validate XHTML | Validate CSS