Length Effect
Longer pendulums have longer periods. Try L = 0.5m vs L = 2.0m to see the difference.
By the end of this lecture, you should be able to:
A simple pendulum consists of a mass (bob) attached to a string of length L, swinging under the influence of gravity.
Key Variables:
The motion of a pendulum is governed by the equation:
For small angles (θ < 15°), we can use the approximation sin(θ) ≈ θ:
This gives us simple harmonic motion with period:
Let’s implement the pendulum model step by step:
import numpy as npimport matplotlib.pyplot as pltfrom matplotlib.animation import FuncAnimation
# Physical parametersL = 1.0 # Length (m)g = 9.81 # Gravity (m/s²)theta0 = 0.3 # Initial angle (radians)omega0 = 0.0 # Initial angular velocity
# Time parametersdt = 0.01 # Time stept_max = 10 # Total timetime = np.arange(0, t_max, dt)
def pendulum_ode(theta, omega, t): """Pendulum equations of motion""" dtheta_dt = omega domega_dt = -(g/L) * np.sin(theta) return dtheta_dt, domega_dt
# Solve using Euler methodtheta = np.zeros(len(time))omega = np.zeros(len(time))
theta[0] = theta0omega[0] = omega0
for i in range(len(time)-1): dtheta, domega = pendulum_ode(theta[i], omega[i], time[i]) theta[i+1] = theta[i] + dtheta * dt omega[i+1] = omega[i] + domega * dt
# Create animationfig, ax = plt.subplots()ax.set_xlim(-1.5, 1.5)ax.set_ylim(-1.5, 1.5)ax.set_aspect('equal')
line, = ax.plot([], [], 'o-', lw=2, markersize=8)time_text = ax.text(0.02, 0.95, '', transform=ax.transAxes)
def animate(frame): # Calculate position x = L * np.sin(theta[frame]) y = -L * np.cos(theta[frame])
# Update pendulum line.set_data([0, x], [0, y]) time_text.set_text(f'Time = {time[frame]:.1f}s') return line, time_text
ani = FuncAnimation(fig, animate, frames=len(time), interval=50, blit=True)plt.show()
Tip: Try different lengths to see how period changes. Add damping to see oscillations decay. Large angles show nonlinear behavior!
Explore how different parameters affect pendulum behavior:
Length Effect
Longer pendulums have longer periods. Try L = 0.5m vs L = 2.0m to see the difference.
Initial Angle
Large angles break the small angle approximation. Compare θ₀ = 0.1 rad vs θ₀ = 1.0 rad.
Damping
Add air resistance: domega_dt = -(g/L) * np.sin(theta) - b * omega
Clock Pendulum Design
Design a pendulum clock that ticks every second (period T = 2s). What length should the pendulum be?
Using the period formula for small oscillations:
Solve for L:
Substituting values:
Therefore, the pendulum should be approximately 1 meter long.
Pendulum Experiment
In the next lecture, we’ll explore spring-mass systems and learn about resonance, natural frequencies, and how these concepts apply to vibration control in engineering systems.
Comments