#Import recquired models1import numpy as np2import matplotlib.pyplot as plt34#This allows us to code for ODEs5from scipy.integrate import odeint67#Setting values8g = 9.819L = 21011#Function- We convert the SHM ODE of a pendulum into 2 first order ODEs12def model(y,t,g,L):1314#theta'(t) = omega(t)15#omega'(t) = -(g/L)*(sin(theta(t)))1617theta, omega = y18dydt = [omega, -(g/L)*(np.sin(theta))]19return dydt202122#initial conditions23#sets that at time=0, angular velocity is 3 radians per second24y0 = [0-0.1,0.0]2526#time points27t = np.linspace(0,10,101)2829#solve ODE30sol = odeint(model, y0, t, args=(g,L))3132#plotting results33plt.plot(sol[:,0], sol[:, 1], 'b')34plt.ylabel('Angular velocity (radians per seconds)')35plt.xlabel('Angular displacement (radians)')36plt.title('Fig 3')37plt.grid()38plt.show()39plt.show()404142