A pendulum consists of two parts; A Mass, and a String, one end of which is fixed.
There are two forces acting on the mass; Gravity and the Tension from the string.
These two forces combine to make the mass travel on a circular path. For the purpouses of a simple
computer simulation of a pendulum, you can assume that the string cannot stretch or compress, and
is in effect, a solid bar. Because a pendulum is basically falling, and we all know that
everything falls at a constant acceleration, the mass can be ignored too. This leaves the pendulum
with the following properties.
Angle = Angle + AngVel
And there you have it, nothing could be simpler. Aah, but there is one more thing, damping. Real
pendulums do not swing forever. They suffer friction and slow down. To simulate this, one more
line can be added:
AngVel = AngVel + (sin(Angle) / length)
AngVel = AngVel * Damping
where Damping is a value slightly less than 1, say 0.99. This will make the system lose
energy and eventually slow to a standstill.