Let’s see how we can use matplotlib to model pendulum motion.

Pendulum

Here we will examine qualitatively the applicabiltiy of the theta based model in modelling pendulum motion. Let’s first consider releasing from an angle of π/3. Can you tell the difference?

No? Let’s have a look at releasing from 2π/3.

Qualitatively, we deduce that the theta model does not match our intuition for how real pendulums behave at large angles.

def real_pendulum_ode(conditions, t, =0.2, g=9.8):
    ##current state of θ and ω is in the conditions list
    θ, ω = conditions
    
    dydt = [ω, -g/*sin(θ)]

Solving the real system is as simple as

from scipy.integrate import odeint
solutions = odeint(real_pendulum_ode, init_conditions, t_interval)

Imagine doing such a calculation with pencil and paper! Newton would be proud.