Consider a uniform rigid bar of mass m and length L that has been fastened to a stationary support at point P, as shown in the figure below. Assume that the bar is constrained to rotate in a 2D vertical plane when it is displaced from its vertical equilibrium position and released.

The figure shows the pendulum at an instant in time in which it is rotating in a counterclockwise direction with angular speed θ˙, and has an angular displacement of θ with respect to its equilibrium (θ=0) position. If we neglect forces that produce any damping or driving torques, then the bar’s weight is the only force exerted on the bar that produces a torque about point P. In the figure the weight mg of the bar is represented by the force vector drawn at the position of the bar’s center of mass CM. We shall use a sign convention such that any torque that tries to produce an angular acceleration in the counterclockwise direction contributes a positive amount to the total torque acting on the bar, and any torque that tries to accelerate the bar in the clockwise direction is a negative contribution. With this sign convention the torque exerted on the rigid bar by its weight is

(1)τmg=mgL2sinθ.

The rotational analog to Newton’s 2nd Law of motion is

(2)τ=Iθ¨,

where I is the moment of inertia of the bar about the point P, and θ¨ is the angular acceleration. If we consider all of the bar’s mass to be concentrated at the position of its center of mass, then

(3)I=m(L/2)2.

Inserting Equations (1) and (3) into (2), and a little rearranging produces

(4)θ¨=2gLsinθ

for the angular acceleration.

If we include the influence of a damping torque, that acts to oppose the rotational motion of the bar, and a sinusoidal driving torque, then

(5)τ=τmg+τdamping+τdriving=m(L2)2θ¨.

With the bar rotating in a counterclockwise direction, the damping torque tries to accelerate the bar in the clockwise direction. Thus, like the torque due to gravity, the sign of the damping torque is negative. For the damping torque we use τdamping=bθ˙, where b is a constant, and has units of kgm2/s. The constant bcan be thought of as an effective “damping strength” that characterizes the damping effects due to air resistance as the bar rotates through the atmospheric fluid, and any friction between the bar and the supporting mechanism at point P. For the driving torque we use τdriving=τdcosωt, where τd is the amplitude and ω is the driving frequency in rad/s. Thus, Equation (5) becomes

(6)mgL2sinθbθ˙+τdcosωt=m(L2)2θ¨.˙

Solving for the angular acceleration we arrive at

(7)θ¨=2gLsinθ4bmL2θ˙+4τdmL2cosωt

for the rigid damped driven pendulum.

See the pseudocode for the implementation of the Euler-Cromer algorithm for solving Equation 7.