Magnetic Pendulum Simulation