A simple pendulum is constructed by placing a mass m at the end of a rod of length L with negligible mass.  The system oscillates about the lower vertical position due to a torque ? about the pivot produced by gravity acting on the mass.  Although a pendulum oscillates, the angle cannot be described by simple trigonometric functions except for small angles.  Newton's Law for planar rotation states that the angular acceleration ? of an object is proportional to the torque ? applied to that object
? = I ? .
The constant of proportionality I is known as the moment of inertia and can be shown to be I = mL2 for a mass that is a distance L from the point of rotation.  Applying Newton's Second Law for rotation to the pendulum leads to the following second-order differential equation
d2 ? / dt2 = -(g/L) sin( ? ) .
Comparing this dynamical equation to the simple harmonic oscillator differential equation, we see that the pendulum  equation undergoes simple harmonic motion for small angles when the approximation  ? ~ sin( ? ) is valid.  The angular frequency ?= 2?f  for this small angle motion is  ?= (g/L)1/2.
References:
The Simple Pendulum model is designed to teach Ejs modeling.  Right click within the simulation to examine this model in the Ejs modeling and authoring tool.  See:
"Modeling Physics with Easy Java Simulations" by Wolfgang Christian and Francisco Esquembre, The Physics Teacher, November 2007, 45 (Cool, pp. 475-480.
The Easy Java Simulations (EJS) manual can be downloaded from the ComPADRE Open Source Physics collection and from the Ejs website.
Note:
This simulation was created by Wolfgang Christian and Francisco Esquembre using the Easy Java Simulations (Ejs) modeling tool. You can examine and modify this simulation if you have Ejs installed by right-clicking within a plot and selecting "Open Ejs Model" from the pop-up menu. Information about Ejs is available at: .

The Pendulum model uses polar coordinates to compute the displacement angle ? but the pendulum bob in the simulation's view is positioned using Cartesian coordinates.  We create x and y auxiliary variables to synchronize objects in the view with the model.  These Cartesian coordinates are computed from the displacement angle when they are defined and after every animation step using an Ejs Constraints page

Because mouse actions are enabled on the bob's properties page and because the model's x and y variables are bound to the bob's x and y properties, the model's x and y variables change when the bob is dragged.  This binding of on-screen properties to a model's internal variables encourages us to define a custom method newPosition that computes the displacement angle ? from the bob's Cartesian coordinates.  The newPosition method also sets the bob's velocity components to zero and insures that the final coordinates are the correct distance L from the pivot point.  The newPosition method is called in response to a mouse drag by entering the method name as the drag action in the bob's properties page.