Pendulum simulation