Dynamical Systems

Non-Linear dynamical system

What we call a chaotic pendulum is just a pendulum with friction and a driving torque but with no small-deflection-angle approximation. Putting these parameters together we have the equation of motion of the nonlinear pendulum:

\frac{d \theta^2 }{dt^2} = \frac{-g}{L} sin(\theta) -q \frac{d \theta}{dt} + F_D sin(\Omega_D t)

Where is acceleration due to gravity, is the length of string, is the velocity dependent damping force and is the sinusoidal driving force. Therefore the value of will determine the driving force, with being the system with no driving force.

Question

  • 1 - Write a program to solve the above equation.

  • 2 - Plot the time evolution of and the phase space for the following values of : 0, 0.4, 0.8. Comment the obtained result.

Solution
1
"""
2
@author: yacine.mezemate
3
"""
4
5
# Implementing the Euler-Cromer Method for a set number of data points
6
from __future__ import division
7
from math import *
8
from scipy import *
9
import numpy
10
import matplotlib.pyplot as plt
11
12
# Initial theta values
13
theta0 = (10*2*pi)/360
14
omega0 = 5*2*pi/360
15
16
# Constants
17
L = 9.8
18
g = 9.8
19
omega_d = 1/3
20
damping_force = 0.05
21
22
# Defining the driving force - controls the chaos
23
f0 = 0.9
24
25
# Assigning the number of data points to be considered
26
data_points = 3700
27
28
# Preallocating space for time, theta and omega
29
time = zeros(data_points)
30
theta = zeros(data_points)
31
omega = zeros(data_points)
32
33
# Initializing theta and omega
34
theta[0] = theta0
35
omega[0] = omega0
36
37
# Time step
38
dt = 0.05
39
40
for i in range(0, data_points-1):
41
    time[i+1] = time[i] + dt
42
 
43
    omega[i+1] = omega[i] - (g/L)*sin(theta[i])*dt - (
44
    damping_force*omega[i]*dt + f0*sin(omega_d*time[i])*dt)
45
    
46
    theta[i+1] = theta[i] + omega[i+1]*dt
47
48
plt.figure(1)
49
plt.plot(time, theta)
50
plt.ylabel(r"$\theta$", fontsize=18)
51
plt.xlabel(r"time", fontsize=18)
52
plt.show()
53
54
55
plt.figure(2)
56
plt.plot(theta, omega)
57
plt.ylabel(r"$\dot{\theta}$", fontsize=18)
58
plt.xlabel(r"$\theta$", fontsize=18)
59
plt.show()
PreviousPreviousNextNext
HomepageHomepagePrintPrintCreated with Scenari (new window)