Pendulum on an Accelerating Train

This simulation uses Easy Java Simulations (Ejs) to model the problem of pendulum on an accelerating train.  The problem assumes that the pendulum rod is massless and of length, L = 2, and the pendulum bob is of mass, m = 1.  In the simulation you can set the initial pendulum angle, the initial velocity of the train, and the acceleration of the train:

θ0 ,  v0 ,  and   a .

There are two possibilities for this problem:

The Equilibrium Case:  In this case the sum of the forces acting on the pendulum bob add up to zero.  This problem can be easily solved with Newton's laws.

The Dynamic Case:  In this case the pendulum oscillates about the equilibrium point found in the Equilibrium Case.  This problem is most easily solved using Lagrange mechanics for the equation of motion for the angle theta.