0% found this document useful (0 votes)
8 views15 pages

Nonlinear Pendulum Analysis and Methods

Uploaded by

adwythnair
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views15 pages

Nonlinear Pendulum Analysis and Methods

Uploaded by

adwythnair
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

The Nonlinear Pendulum

- Pádraig Ó Conbhuı́ -
08531749 TP Monday

1. Abstract
This experiment was performed to examine the effects that linearizing equations has
on the accuracy of results and to find ways of accurately determining the outcome of
equations without linearization, specifically in the case of the nonlinear pendulum.
It was found that for a simple pendulum, linearized equations were accurate for small
values of θ and for damped oscillators, linearized equations were accurate after long time
periods.
It was also shown that certain characteristics of a system can be lost with linearization.
The chaotic nature of a damped, driven pendulum was also probed, with graphs drawn
of the phase space of the oscillator as a control parameter was incremented.

2. Background and Theory


A common method of solving equations is by linear approximation, often by use of a
Taylor Series expansion. In the case of a simple pendulum, the equation of motion is:
d2 s d2 θ
= L = −g sin(θ)
dt2 dt2
Where s is the displacement in the x-direction, θ is the angular displacement of the
pendulum from equilibrium and L is the radius of the arc it traces out. By expanding
3
sin(θ) about 0, it can be shown that sin(θ) = θ + θ3! , so:
sin(θ) ≈ θ for θ ≈ 0
Using this, the equation can be rewritten:
F ≈ −gθ
This method is good for finding solutions for the system when theta is small, but at
higher values, the term in θ3 starts growing rapidly. This method, however, is only good
for finding solutions to specific examples of the general case. In general, θ would be much
greater than 0. It remains to find a method of resolving the general case.
While it may be impossible to find an analytical solution for the pendulums position
in time, the motion of the pendulum can, itself, be simulated, and the results noted. This
simulation can be done much quicker than real time and on almost any scale in which
the equation is still applicable on a computer. A program can be written which makes
use of an iterative solution of motion, of which there are several. Two of these methods
shall be detailed here.

1
2.1 The Euler Method
From the equations of motion, there is a second order equation, namely

d2 θ
= f (θ, ω, t)
dt2
Where f is some function of the force on the pendulum. This can be made into two first
order equations:
dθ(t) dω(t)
= ω(t) and = f (θ, ω, t)
dt dt
These can then be expanded in a Taylor series to find their next timestep. These are
found to be

θ(t + ∆t) = θn+1 = θn + ωn ∆t + O(∆t2 )

ω(t + ∆t) = ωn+1 = ωn − θn ∆t + O(∆t2 )

And using the Trapezoid Rule, based on the integral being the area under a graph, an
even better approximation can be derived.

k1a = ωn ∆t

k1b = f (θn , ωn , t) ∆t
k2a = (ωn + k1b ) ∆t
k2b = f (θn + k1a, ωn + k1b , t + h) ∆t

k1a +k2a
θn+1 = θn + 2
k1b +k2b
ωn+1 = ωn + 2

Iterating over these functions θn+2 and ωn+2 can be gotten and so forth for however
long is desired. By listing the values obtained, a graph of the pendulum’s motion can be
drawn. This method, however, is only accurate to O(∆t2 ).

2
2.2 The Runge-Kata Method
The Runge-Kata Method is different from the Trapezoid Rule by way of integrating
about the midpoint of a timestep instead of at the end, as is done in the latter. This
makes it a much more accurate method, but it requires more equations to be solved and
computed.
It is computed in a similar fashion, but has a higher order of accuracy. The Algorithm
outlined here is accurate to a 4th order of the timestep and is as follows

k1a = ωn ∆t k1b = f (θ, ωn , t) ∆t


k1a k1b ∆t
k2a = (ωn + k1b /2) ∆t k2b = f (θ + 2
, ωn + 2
, t+ 2
) ∆t
k2a k2b ∆t
k3a = (ωn + k2b /2) ∆t k3b = f (θ + 2
, ωn + 2
, t+ 2
) ∆t
k4a = (ωn + k3b ) ∆t k4b = f (θ + k3a , ωn + k3b , t + h) ∆t

k1a +2k2a +2k3a +k4a


θ(t + ∆t) = θ(t) + 6
k1b +2k2b +2k3b +k4b
ω(t + ∆t) = ω(t) + 6

This greater accuracy is necessary for modelling damped driven oscillators. In the
case given, the acceleration, f , of the pendulum was of the form

f = −β 2 sin(θ) − kω + A cos(Ω)

3
3. Method of Implementation
Programs written in C were used to compute these iterative functions, comprising of
a simple for loop which would first calculate the values of θ and ω at the current time,
increase the time by ∆t and then write the time, the position and the velocity of the
pendulum to a document. The points written to the document were then graphed using
gnuplot.
Results were compared and contrasted and results were concluded on the accuracies
of each method and the nature of the pendulums.

For the sake of speed, system calls were made from the program to automate the
running of gnuplot and any filesystem manipulations were done through bash scripting.

The basic structure of the program was

1. Accept variables from the command line

2. If no variables are given, display quick manual message.

3. Begin iterative calculation. If linear option is included in the command line, do the
linear calculation simultaneously. Write current variables to [Link] file on each
iteration

4. Customize gnuplot input based on command line options, mostly just filename
manipulation so the parameters used in a plot can be identified from the name.

5. Write gnuplot commands to [Link] file. Run a system call asking gnuplot to run
[Link]. Files were written as png.

6. If command line option is used, edit newly created file names and create a directory
for them, so they can be easily identified with eachother.

7. Run ‘Eye Of Gnome’ (eog) through a system call asking it to open all the recently
created files so they can be inspected.

8. Done.

The first program written was to compare the linear approximation to actual nonlinear
function discussed in section 2 of this paper using the Euler Method. The program
simultaneously ran the simulation of the pendulum using both the linear and the nonlinear
function.
The second program was pretty much the exact same thing, but using the Runge-Kata
algorithm instead.

4
4. Results and Analysis
The following graphs were obtained by running the data gathered from the compiled
programs through gnuplot.

4.1 Effects of Linearization


- 4.1.1 Phase Spaces -
First, an example of a typical phase space for a simple pendulum using the Euler
Method and a small value of θ.

5
As can be seen, there is little difference in the overall shape of the phase spaces, they
are both harmonic oscillators.
However, for large θ, there is an interesting result.

As can be seen, the nonlinear phase diagram is no longer closed. This is indicative of
the pendulum spinning about its pivot. This is an important result and will be discussed
in the next section.

6
- 4.1.2 Trajectories -
Below are trajectories from several simulated pendulums using the Euler Method.

7
As can clearly be seen, the smaller the maximum displacement of θ is, ie the smaller
θ is (not just it’s starting position) the closer the linearized trajectory is to the actual
trajectory.
In the last graph here is further proof that this pendulum is spinning about it’s axis.

8
- 4.1.3 The Damped Pendulum -

9
This is an assortment of different initial values for damped oscillators, simulated using
the Runge-Kata method. Here, linearized equations were compared to the actual motion
of the oscillator. In all cases, the linearized version approximated the nonlinear version
quite well given enough time, even if just coming to a halt.

10
4.2 Nonlinear Systems
In this section, the Runge-Kata method was used to simulate a nonlinear system.
To show how it compares to the Euler Method, two simulations of the same system are
below, the first using the Euler Method and the second Runge-Kata.

Obviously these are not the same. Considering The Runge-Kata method is accurate
O(∆t4 ), and the graph looks more believable, it is likely more accurate.

11
Advantage is taken of the accuracy of this method to calculate the trajectory of an
otherwise unpredictable system with reasonable accuracy.
Below are graphs of the phase space of a system as its control parameter is tweaked.

Figure 1.

Figure 2.

12
Figure 3.

Figure 4.

13
Figure 5.

As can be seen, as the parameter A is increased, the system becomes more and more
chaotic, until it reaches a totally chaotic state.

14
5. Conclusions and Discussion

5.1 Effects of Linearization


Given that θ is small, linearization gives a very good approximation of the actual
trajectory. In most cases, for a reasonable θ, the linearized trajectory more or less follows
the actual path. Comparing the diagrams of section 4.1.2 shows this quite clearly. In all
cases, however, the linear approximation is accurate for some small amount of time.
A similar effect is seen in section 4.1.3, where the linear approximation becomes
accurate after some long amount of time. This is due to the constant retarding force in
the governing equation which is proportional to the velocity. For a damped oscillator,
eventually, linearization doesn’t make a difference.
However, upon linearization, certain attributes of the system may be completely lost.
Take the example of the pendulum spinning about its axis from section 4.1.1. In lineariza-
tion, the pendulum is likened to a spring, meaning the greater the angular displacement,
the greater the return force. However, in the actual governing equation, sin(θ) is used,
which starts decreasing again past a certain threshold, meaning a pendulum need not
necessarily oscillate. This is an example of a behaviour completely lost in linearization.
For this reason it is important to be able to solve, or at least simulate nonlinear systems
without linearization.

5.2 Nonlinearity and Chaos


As was seen in section 4.2, eventually the damped, driven oscillator became chaotic.
This is a direct result of its nonlinearity.
The form of the acceleration was that of having a force field, a dampening force and
a driving force act on the pendulum. Given a low driving amplitude, the pendulum
remained rather well behaved. Upon increasing the drive amplitude, the periodicity of
the pendulum began to change.
In figure 1, the pendulum exhibits a rather normal oscillatory behaviour. In figure 2,
while the shape is still closed, it is no longer one path, but seemingly two. It is, however,
still periodic.
In figure 3, it is no longer a harmonic oscillator, since it doesn’t follow a closed path.
In figure 4, a bifurcation is observed before becoming chaotic in figure 5.

Nonlinearity and chaos, as subjects, are rather recent, due in no small part to the
absolute necessity of a computer to process the given data and to perform the required
iterative calculations. By modelling a system like this on a computer, it makes under-
standing real world applications of such systems much easier.

15

You might also like