This video shows how to simulate the motion of a pendulum in VPython. The pendulum is one of the simplest systems in physics which consists of a bob, string and a pivot. The pendulum oscillates under the effect of gravity when it is disturbed from the equilibrium position. The simulate can be understood by anyone who has basic knowledge of physics, basic programming knowledge will be helpful.
You can read the detailed article about this simulation at
http://techforcurious.website/simulation-of-pendulum-vpython-tutorial-visual-python/
You can get the code here
http://www.glowscript.org/#/user/techforcurious/folder/Pendulum/
Correction: There is a mistake in the convention of coordinates. The y coordinate of bob should be defined as Pivot.y-lcos(theta) rather than just HE because E is not located at origin and y of bob should be measured from the origin. Similarly cos(theta) = (Pivot.y-bob.y)/l. Now, the simulation is running fine.
Follow us on:
Facebook: https://www.facebook.com/techforcurious
Twitter: https://twitter.com/techforcurious
Website: http://techforcurious.website/