Consider a uniform rigid bar of mass m m and length L 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)θ=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 m g m g 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

τ m g=−m g L 2 sin θ.(1)(1)τ m g=−m g L 2 sin⁡θ.

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

∑τ=I θ¨,(2)(2)∑τ=I θ¨,

where I 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

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

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

θ¨=−2 g L sin θ(4)(4)θ¨=−2 g L sin⁡θ

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

∑τ=τ m g+τ d a m p i n g+τ d r i v i n g=m(L 2)2 θ¨.(5)(5)∑τ=τ m g+τ d a m p i n g+τ d r i v i n g=m(L 2)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 τ d a m p i n g=−b θ˙τ d a m p i n g=−b θ˙, where b b is a constant, and has units of kg⋅m 2/s kg⋅m 2/s. The constant b 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 τ d r i v i n g=τ d cos ω t τ d r i v i n g=τ d cos⁡ω t, where τ d τ d is the amplitude and ω ω is the driving frequency in rad/s. Thus, Equation (5 5) becomes

−m g L 2 sin θ−b θ˙+τ d cos ω t=m(L 2)2 θ¨.˙(6)(6)−m g L 2 sin⁡θ−b θ˙+τ d cos⁡ω t=m(L 2)2 θ¨.˙

Solving for the angular acceleration we arrive at

θ¨=−2 g L sin θ−4 b m L 2 θ˙+4 τ d m L 2 cos ω t(7)(7)θ¨=−2 g L sin⁡θ−4 b m L 2 θ˙+4 τ d m L 2 cos⁡ω t

for the rigid damped driven pendulum.

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