Air Drag On Pendula and Chaos in The Double Pendulum
Air Drag On Pendula and Chaos in The Double Pendulum
Air Drag On Pendula and Chaos in The Double Pendulum
Solver: adleiavde
Part (a)
Problem statement. Create a simulation of a mathematical pendulum (don’t assume sin x = x),
then add air drag force on the pendulum bob. Compare in one plot the time evolution of the
angle made by two simple pendula, with same initial conditions, but one with linear F = −av,
and one with quadratic air drag F = −bv|v|. Choose air resistance coefficients so the air drag is
similar in magnitude in both cases.
Theoretical background. Below, I’ve attached a diagram displaying the relevant forces on the pendulum
bob (as seen from its non-inertial frame of reference). Here, I’ve worked with a more general drag force
model, Fdrag = −λn v|v|n−1 , while the problem statement is asking to consider the n = 1 and n = 2 cases
(with λ1 = a and λ2 = b).
θ
Fdrag = −λn v|v|n−1
T
θ̂
O
v Fcentrifugal
r̂ mg
It is useful to study the motion in polar coordinates, since the system only has one degree of freedom – the
angle θ. Thus, I’ve chosen the unit vectors r̂ and θ̂ corresponding to the radial and tangential axes. Newton’s
second law reads mg + Fcentrifugal + Fdrag + T = 0, so its projection on the θ̂ axis is
The sign + corresponds to the depicted case, when the bob is descending (it moves towards the equilib-
rium point), while the sign − corresponds to the case when the bob is ascending (it moves away from the
equilibrium point). It is easy to see that |v| = |ω|` = |θ̇|`.
Computational approach.
Outline. I’ve used scipy.integrate.solve_ivp as the engine that solves the differential equations of
motion. Then, I set up a matplotlib animation in order to visualize the motion of the pendulum (with
and without drag forces). Using the data from the numerical solutions to the ODEs, I plotted (on the same
graph) the functions θ1 (t) and θ2 (t). See Part (c) for a very brief overview of the ODE solver.
Choosing the values (by rough estimation). The problem text reads "Choose air resistance coefficients
so the air drag is similar in magnitude in both cases", which means that an estimation needs to be made
in order to pick the constants a and b appropriately. For large velocities, the quadratic force is going to be
larger (obviously), whilst for very small velocities, the linear force is going to be larger. A balance needs
to be found between these effects. Taking into account the fact that the pendulum bob will spend most of
its time in the small-v region (damping decreases, so the acceleration decreases as well), I will estimate the
Page 3 PoTW 1 Solver: adleiavde
√
p of the mean velocity to be about v ∼ vmax (1 − 1/ 2) - this is sort of a geometric mean. Moreover,
magnitude
vmax ∼ 2g`(1 − cos θ0 ). Equating the two mean drag forces yields
p √ √ p √
a 2g`(1 − cos θ0 )(1 − 1/ 2) ≈ b · 2g`(1 − cos θ0 )(1 − 1/ 2)2 =⇒ a/b ≈ 2g`(1 − cos θ0 )(1 − 1/ 2).
I will run the simulations for θ0 = 50◦ , ω0 = 0, g = g0 ≈ 9.80665 ms−2 , m = 1 kg, ` = 1 m. An appropriate
value for the aforementioned ratio might be b/a ≈ 0.75, so choosing a = 0.25, I’ll pick b ≈ 0.19.
def animate1 ( i ) :
pendulum1 . set_data ([0 , x1 [ i ]] , [0 , y1 [ i ]])
time_text . set_text ( time_template % ( i * dt ) )
return pendulum1 , time_text
def animate2 ( i ) :
pendulum2 . set_data ([0 , x2 [ i ]] , [0 , y2 [ i ]])
time_text . set_text ( time_template % ( i * dt ) )
return pendulum2 , time_text
Figure 3: θ1,2 (t) on the same plot for different values of drag coefficients.
As anticipated, Fig. 2 shows that the amplitude of the oscillations is smaller for the quadratic drag model
at the beginning (high velocity implies greater drag), but then the linear drag model quickly "burns out"
the advantage it gained at the beginning, in the domain of small velocities. In Fig. 3, I have attached two
other graphs for different values of a and b.
Page 6 PoTW 1 Solver: adleiavde
Problem statement. Rony has built a (real) pendulum, with parameters as shown in Fig. 1, from a
stiff thread and a spherical bob. His pendulum, however, experiences air drag on both its rod and bob.
He measured 12 graphs for different parameters, which he gives to you in Fig. 2 – you can find the
exact values in a spreadsheet/ txt format in the graphs.zip file. Is the air drag on the pendulum
linear or quadratic? Find λ. After finding out the air drag type, determine the air drag force
as a function of all relevant parameters, determine the dimensionless coefficients as well!
(You can assume the air drag to be of the same type on the whole pendulum - i.e. there is linear drag
on bob if and only if there is also linear drag on rod). – it is advisable to set up a fitting program,
which can fit any kind of functions.
Theoretical background. Below, I’ve attached a diagram displaying the relevant forces acting on the real
pendulum (as seen from its non-inertial frame of reference).
n
x dFt = −ct dAv (x)v̂
θ
dx
Fb = −cb v n v̂
v(x) T
θ̂
O
v Fcentrifugal
r̂ mg
The equations of motion are found by writing the torques about the point of suspension. An assumption I
will make is that the drag forces are proportional to the cross-sectional area of the object examined.
Linear drag. The infinitesimal torque on a thread element is given by dMt = F (x)x = −ct dAv(x)x =
−ct (2rdx)v(x)x, hence:
λgL2 sin θ
−mgL sin θ − − Fb L + Mt = Iα,
2
ˆ L
λgL2 sin θ
3
λL
−mgL sin θ − − cb θ̇L2 − 2rct θ̇x2 dx = + mL2 θ̈,
2 0 3
λL
3cb + 2rct L m+
θ̈ + θ̇ + g sin θ 2 = 0.
λL + 3m λL2
mL +
3
Quadratic drag. The infinitesimal torque on a thread element is given by dMt = F (x)x = ∓ct dAv 2 (x)x =
∓ct (2rdx)v 2 (x)x, hence:
Page 7 PoTW 1 Solver: adleiavde
λgL2 sin θ
−mgL sin θ − − Fb L + Mt = Iα,
2
ˆ L 3
2 3 2 3 λL 2
−mgL sin θ ∓ cb θ̇ L ∓ 2rct θ̇ x dx = + mL θ̈,
0 3
2
λL 2 2 L λL
θ̈ + mL ± θ̇ L cb + rct + g sin θ m + = 0,
3 2 2
Computational approach.
Outline. I haven’t been able to code this part for now. I have a couple of ideas, though – one of them
would be to parse the data from the text files, as follows:
data1 = [[ list ( map ( float , line [: -1]. split ( " , " ) ) ) for line in open ( f " m
=0.003 , L =0.{ i }. txt " ) . read () . split ( " \ n " ) [1: -1]] for i in range (1 , 7) ]
data2 = [[ list ( map ( float , line [: -1]. split ( " , " ) ) ) for line in open ( f " m
=0.050 , L =0.{ i }. txt " ) . read () . split ( " \ n " ) [1: -1]] for i in range (1 , 7) ]
data = data1 + data2
From this data, all three of θ, θ̇, θ̈ can be found with reasonable precision for all the data sets.
w = [[( t1 , ( a2 - a1 ) / ( t2 - t1 ) ) for ( t1 , a1 ) , ( t2 , a2 ) in zip ( data_set ,
data_set [1:]) ] for data_set in data ]
alpha = [[( t1 , ( w2 - w1 ) / ( t2 - t1 ) ) for ( t1 , w1 ) , ( t2 , w2 ) in zip ( w_set ,
w_set [1:]) ] for w_set in w ]
I think it’s possible to (somehow) use scipy.optimize.curve_fit to find the parameters, but I’m not sure
how to go about that. That’s about all I could do for this subpart. Just by looking at the graph, my
prone-to-error guess would be that the drag is quadratic, judging by the fact that the right side of the graph
seems to attenuate slowly, which is valid for quadratic drags under small-velocity conditions.
(Incomplete solution)
Page 8 PoTW 1 Solver: adleiavde
Part (c)
Problem statement. Rony now remembered he can use the masslessium from the engineering prob-
lem to build a proper ideal pendulum, ”but why stop there?” - he asks. Find the equations of
motion of an ideal double pendulum and numerically simulate its motion. For bonus
points, find the equations of motion if there was a linear/ quadratic drag on the bobs!
Theoretical background. Searching the equations of motion online is explicitly allowed. Guess what, I
did that. Citing web.mit.edu – myPhysicsLab.com (which, for that matter, also includes a simulator written
in Javascript – my code is written entirely independently of that script):
Computational approach.
Outline. I’ve used scipy.integrate.solve_ivp as the engine that solves the differential equations of
motion. Then, I set up a matplotlib animation in order to visualize the motion of the double pendulum
(without drag forces). Using the data from the numerical solutions to the ODEs, I generated multiple
plots, as described below. There are a few things to note about the approach used to solve the differential
equation. It is well-known that the motion of the double pendulum is highly chaotic: a tiny change in
initial conditions can lead to tremendous differences in the long-term behaviour of the system. Thus, I’ve
chosen an explicit Runge-Kutta method of order 8, which is recommended by the SciPy documentation
for high-precision numerical problems (note: requires SciPy versions ). You can, however, choose between
the various methods provided by the SciPy package. More information about these numerical methods for
solving ODEs can be found online, but they all rely on the fact that the time interval is discretized and then
successive tiny changes in the value of the solution (the function satisfying the DE) are recorded.
Plotting. For this subpart, my program has generated two types of graphs. The first one is a temporal plot
of θ1 (t) and θ2 (t), which can be used to assess the periodicity of the angles in time, but which isn’t otherwise
relevant. The second one represents the motion of the double pendulum in the phase space θ1 − θ2 , which
provides more relevant information about the degree of chaos displayed by the system. Additionally, I set
up a matplotlib animation that shows the real-time motion of the double pendulum.
def animate ( i ) :
pendulum . set_data ([0 , x1 [ i ] , x2 [ i ]] , [0 , y1 [ i ] , y2 [ i ]])
time_text . set_text ( time_template % ( i * dt ) )
Page 10 PoTW 1 Solver: adleiavde
# Turn the angles from radians to degrees and wrap them to the interval -
pi , pi
angles1 = ( np . rad2deg ( solution . y [0]) + 180) % 360 - 180
angles2 = ( np . rad2deg ( solution . y [1]) + 180) % 360 - 180
All the graphs generated by this program have been attached at the end of the document. It can be seen,
as noted in the last part of the POTW, that some angles generate pretty-looking quasi-periodic plots in the
phase space θ1 − θ2 , while some yield highly chaotic representations.
Page 11 PoTW 1 Solver: adleiavde
Part (d)
Problem statement.
Oh no! Things got out of hand and the motion became really chaotic, as he released it at a 90◦ angle.
As Rony really hates chaos, help him find the maximal initial angle at which the pendula
can be released, so that the motion can be regarded as not chaotic. – it is advisable to
dθ1 dθ2
create a Poincaré section from the ω1 − ω2 graph, e.g. on the line ω2 = 0. ω1 = , ω2 = .
dt dt
Computational approach.
Outline. See part Part (c) for information regarding solving the ODEs. I defined a new function S(th0)
which takes an initial angle in degrees (as a float) as input and returns a numpy array containing the values
of ω1 for which ω2 changes sign from positive to negative.
Plotting. Then, on a single scatter plot, the values contained in S(θ0 ) have been plotted against θ0 – see
Fig. 5. The conclusions can be read below.
def S ( th0 ) :
# Constructing the objects in which the numerical solution is going to
be stored
state = np . radians ([ th0 , th0 , 0 , 0])
solution = integrate . solve_ivp ( lambda t , state : deriv ( state , t ) , ( t
[0] , t [ -1]) , state , method = ’ DOP853 ’ , t_eval = t )
w1 = solution . y [2]
w2 = solution . y [3]
idx = np . argwhere ([( x == 2.0) for x in np . diff ( np . sign ( w2 ) ) ]) . flatten
()
return w1 [ idx ]
angles = np . arange (1 , 90 , 2)
for angle in angles :
for y in S ( angle ) :
ax . scatter ( angle , y )
plt . show ()
Conclusions. Fig. 5 depicts the generated scatter plot for values of θ0 covering the entire range of (0, 90]◦ .
It can be seen that there are multiple distinct portions, which turn out to encode different states of the
double-pendulum system:
• From θ0 = 0◦ to θ0 ≈ 40◦ : The Poincare section covers approximately the entire range of values of
ω1 and thus generates some sort of triangle for the first part of the scatter plot. This means that the
motion is highly predictable and follows some non-chaotic patterns.
• From θ0 ≈ 40◦ to θ0 ≈ 65◦ : The Poincare section covers peripheral values of ω1 and has the visual
appearance of a hollow region, for the second part of the scatter plot. This portion also displays orderly
motion, but it’s a different type compared to the first portion.
• From θ0 ≈ 65◦ to θ0 ≈ 80◦ : The Poincare section covers with greater density peripheral values of ω1 ,
but unlike the second portion, it also includes a (small) but non-zero amount of close-to-the-median
values, and thus has the visual appearance of a bell positioned horizontally from left to right. This
portion is also not (entirely) chaotic, but again it differs significantly from the previous two parts.
• For θ0 ≥ 80◦ : Entirely chaotic regime, which on the scatter plot has the visual appearance of a rectangle
with a greater amount of values of ω1 towards the sides, but also a few weirdly positioned points close
to ω1 = 0. This portion differs substantially from the other three parts.
Since the boundary between order and chaos seems to lie somewhere around 80◦ , I’ve decided to zoom in on
that boundary and generate another scatter plot – see Fig. 6, this time for θ0 ∈ [75, 83]◦ (the values that
visually seem to encompass the switch from one regime to the other). The conclusion is that the maximum
release angle that doesn’t lead to highly-chaotic motion is around 79.1◦ . At the end of the document, I’ve
included a few illustrations of ω1 − ω2 for various angles (hence enabling the reader to see the differences
between the four aforementioned portions).
Page 13 PoTW 1 Solver: adleiavde