Code for demonstrating the importance of momentum, for a post for Safari Books Online