Pendulum on sliding support

 

In the simulation, a simple pendulum is attached to a mass which can slide freely on a horizontal frictionless surface.  Before you run the simulation, predict what you think the motion of the system will look like, and describe your prediction as part of your answer. (Consider that the pendulum bob starts out at t=0 hanging vertically but with an initial velocity to the left.) Also predict what you think the graph of x positions of the pendulum bob and the sliding mass will look like as a function of time, briefly explaining your answer. Now run the simulation. Comment on the correctness of your prediction. Do you think the simulation correctly obeys the laws of physics?

Note: The above is an exercise from Junior Level Mechanics, about generalized coordinates and constructing Lagrangians.