motion of a simple pendulum - trinity college, dublinsmurray/pendulumwriteup.pdf · in this lab the...

11
Motion of a Simple Pendulum Se´ an Murray November 28, 2011 Abstract In this lab the motion of a simple pendulum was found computationaly. Both lin- ear and nonlinear pendulum equations were used, and compared. The methods used for solving the differential equations were, simple Eulers method, the trape- zoid rule, and fourth order Runge-kutta method.The damped driven pendulum was examined and motions of, periodic, period doubling, period quadrupling and chaotic motions were found. Introduction and Theory The equation of motion for the simple pendulum is given by d 2 θ dt 2 = g l sin(θ) where g is acceleration due to gravity and l is the length of the pendulum. This is a nonlinear equation and cannot be solved anyliticaly except for the case of small oscillations where the approximation sin(θ) θ is made. The solution to the linear equation is θ = a * sin(βt + φ) , dt = a * βsin(βt + φ) where a and φ are arbitrary, and β = p g l . Its also useful to consider a damped driven pendulum, with damping pro- portional to angular velocity and a harmonic driving force. The equations of motion can then be written as two first order differential equations for the non linearised case. dt = ω dt = -β 2 sin(θ) - + Acos(Ω) Here k = damping coefficiant, A = driving amplitude, and Ω = driving frequency. For the linear case replace sin(θ) with θ. 1

Upload: doandien

Post on 16-Feb-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Motion of a Simple Pendulum - Trinity College, Dublinsmurray/Pendulumwriteup.pdf · In this lab the motion of a simple pendulum was found computationaly. Both lin- ... where g is

Motion of a Simple Pendulum

Sean Murray

November 28, 2011

Abstract

In this lab the motion of a simple pendulum was found computationaly. Both lin-ear and nonlinear pendulum equations were used, and compared. The methodsused for solving the differential equations were, simple Eulers method, the trape-zoid rule, and fourth order Runge-kutta method.The damped driven pendulumwas examined and motions of, periodic, period doubling, period quadruplingand chaotic motions were found.

Introduction and Theory

The equation of motion for the simple pendulum is given by

d2θ

dt2=g

lsin(θ)

where g is acceleration due to gravity and l is the length of the pendulum.This is a nonlinear equation and cannot be solved anyliticaly except for the

case of small oscillations where the approximation sin(θ) ≈ θ is made.The solution to the linear equation is

θ = a ∗ sin(βt+ φ)

,dθ

dt= a ∗ βsin(βt+ φ)

where a and φ are arbitrary, and β =√

gl .

Its also useful to consider a damped driven pendulum, with damping pro-portional to angular velocity and a harmonic driving force. The equations ofmotion can then be written as two first order differential equations for the nonlinearised case.

dt= ω

dt= −β2sin(θ) − kω +Acos(Ω)

Here k = damping coefficiant, A = driving amplitude, and Ω = drivingfrequency. For the linear case replace sin(θ) with θ.

1

Page 2: Motion of a Simple Pendulum - Trinity College, Dublinsmurray/Pendulumwriteup.pdf · In this lab the motion of a simple pendulum was found computationaly. Both lin- ... where g is

Solving the Equations Numerically

The Simple Euler Method

The Simple Euler Method is a way of solving the equations. It uses a taylorexpansion around the initial conditions and steps forward in a chosen small timeinterval.

θ(t+ ∆t) = θ + ω∆t+O(∆t)2

ω(t+ ∆t0 = ω − θ∆t+O(∆t)2

The Trapezoid Rule

The trapezoid rule is an improvement on the simple euluer method, it takes theaverage of the derivitive at the endpoints of the interval and so we get.

θ(t+ ∆t) = θ + ∆t(2ω + θ∆t

2)

ω(t+ ∆t) = ω − ∆t(2θ + ω∆t

2)

This is accurate to within the second order of ∆t

The fourth order Runge-Kutta Method

The fourth order Runge-Kutta algorithm is given.

θ(t+ h) = θ(t) +k1a + 2k2a + 2k3a + k4a

6

ω(t+ h) = ω(t) +k1b + 2k2b + 2k3b + k4b

6

Wherek1a = hω

k2a = h(ω + k1b

2

k3a = h(ω + k2b

2

k4a = h(ω + k3b)

k1b = f(θ, ω, t)

k2b = f(θ +k1a2, ω + frack1b2, t+ frach2)

k2b = f(θ +k2a2, ω + frack2b2, t+ frach2)

k2b = f(θ + k3a, ω + k3b, t+ h)

2

Page 3: Motion of a Simple Pendulum - Trinity College, Dublinsmurray/Pendulumwriteup.pdf · In this lab the motion of a simple pendulum was found computationaly. Both lin- ... where g is

And f = dωdt as given above.

Using these methods, the graphs of motion of the pendulum with giveninitial conditions could be found, with programming a for loop to find θ and ωas functions of time, for as many time steps as we wanted, with a small enoughtime step.

Method

Pendulum.c

• Using the programme pendulum .c solve the linearised pendulum equa-tion with b2 = 1 with starting values of θ = 0, ω = 1. Then for ω =0, solve for a variety of initial values of θ = 0.2rad, 1.0rad, 3.14rad. In eachcase describe what is happening.

• Then in the programme change the equation to that of a nonlinear pen-dulum by changing theθ term to sin θ. Solve the nonlinear equaion for thesame conditions as before and compare the results of the linear equationto that of the nonlinear equation.

Runge-Kutta Method

• Rewrite the programme pendulum.c so that it solves the pendulum equa-tion using the fourth order Runge-Kutta method in the for loop.

• Check the equation by using it to solve the nonlinear equation with con-ditions used before and compare to the results gotten from the previousequation.

• Examine the damped nonlinear equation. Using b2 = 1, k = 0.5 and aselection of initial conditions. Using graphs of θ vs t compare the resultsto that of the linearised version. Explain why after a certain amount oftime the linear version approxiamtes the nonlinear version well.

• Change the equatoin to make the programme solve for a damped drivenpendulum. Here use b2 = 1, k = 0.5 , Ω = 0.6667 and a range of drivingamplitudes A = 0.9, 1.07, 1.35, 1.47, 1.5. Here to understand the motiondescibed it is best to plot the phase portrait of the motoin, that is ωvθ,and to restrict θ to a range of [ π,−π ]. This is easily done with anotherfor loop.

Important notes on the Programming

• It is very important to have a reasonable time step, the smaller the timestep the more accurate the programme, but making the step too smallmakes the programme impractical and inneficiant. Here we can define the

3

Page 4: Motion of a Simple Pendulum - Trinity College, Dublinsmurray/Pendulumwriteup.pdf · In this lab the motion of a simple pendulum was found computationaly. Both lin- ... where g is

time step as a divisor of the driving period. That way for whatever driveperiod, long or short, we have the same number of time steps in each. Inthis programme make the time step one thousandeth of the driving period.

• It takes a while for the initial trajectory of the pendulum to settle downinto a pattern on its phase space. To disregard this transient motionsimply dont print the first few cycles of the motion. How long it takes tofinish this transient motion will differ in each case, and cutoff point foreach case must be found.

Results and Analysis

The linearised pendulum.c Programme

Here are the results for te linearised pendulum.c programme. The graphs willhave there initial conditions above them

Figure 1: θ = 0, ω = 1

Here the pendulum is starting at the point θ = 0 but has an angular velocityof 1 rad/s, so it swings toward θ = 1 here it loses its angular velocity and swingsback in the other direction to θ = −1, since there is no dampening of the systemand the system is lineaised the pendulum oscillates between theese two pointswith SHM.

Here the pendulum starts at θ = 0.2 with no angular velocity, it swings backto θ = −0.2 and again since there is no dampening and the system is linearisedit oscillates between theese two points with SHM.

This is the same as above but with the pendulums starting at θ = 1 so itoscillates between θ = −1, 1 again with SHM.

4

Page 5: Motion of a Simple Pendulum - Trinity College, Dublinsmurray/Pendulumwriteup.pdf · In this lab the motion of a simple pendulum was found computationaly. Both lin- ... where g is

Figure 2: θ = 0.2, ω = 0

Figure 3: θ = 1, ω = 0

Figure 4: θ = 3.124, ω = 0

This is the same as above again but with the pendulums starting at θ = 3.124so it oscillates between θ = −3.124, 3.124 again with SHM.

5

Page 6: Motion of a Simple Pendulum - Trinity College, Dublinsmurray/Pendulumwriteup.pdf · In this lab the motion of a simple pendulum was found computationaly. Both lin- ... where g is

The Non-Linear case

Here are graphs of θ vs Time, nonlinear case versus the linear case for the sameinitial conditions.

(a) θ = 0, ω = 1 (b) θ = 0.2, ω = 0

(a) θ = 1, ω = 0 (b) θ = 3.14, ω = 0

Here its obvious to see that for small values of θ the linear equation approx-imates the nonlinear case quite well, but for increases in /theta it approximatesit worse and at the largest values of θ around 2π the linear equation really bearslittle resembelence to the nonlinear case.

Note

Noting the nonlinear case with θ = 3.124 and ω = 0 . The initial programmewith a time step of 0.1 gave us a pendulum that was constanlty revolving.

6

Page 7: Motion of a Simple Pendulum - Trinity College, Dublinsmurray/Pendulumwriteup.pdf · In this lab the motion of a simple pendulum was found computationaly. Both lin- ... where g is

Figure 5: θ = 1, ω = 0

When the programme got around to where θshould equal− 3.124 it actuallysolved it to give θ some value just less than −π meaning that it was now just overthe peak and would fall again in the direction of -θ. This continued to happenevery time the pendulum got to its peak which resulted in a constantly rotatingpendulum. This didn’t make sense from our starting conditions (namely ω = 0)so it was quickly realised there was a problem in the programme. To fix this Ilowered the time step to 0.001, increased the iterations by the same factor andreran the programme. This resulted in the expected motion given above.

The Runge-Kutta Method

Using the algorithms for given I changed the programme.c to solve the pendulumequation using the fourth order Runge-Kutta method. To test that it wasworking I used it to solve the nonlinear pendulum equation from the sameconditions as before and compared the results.

(a) θ = 0, ω = 1 (b) θ = 0.2, ω = 0

7

Page 8: Motion of a Simple Pendulum - Trinity College, Dublinsmurray/Pendulumwriteup.pdf · In this lab the motion of a simple pendulum was found computationaly. Both lin- ... where g is

(a) θ = 1, ω = 0 (b) θ = 0.2, ω = 0

As can be seen in the graphs, the values of theta overlap each other so thetwo methods agree in all starting points.

Note

When solving for the initial conditions of θ = 3.124 and ω = 0 with the fourthorder Runge-Kutta method the time step doesnt need to be lowered.Tha is fora time step of 0.1 it solves the system to be a rotating pendulum rarther thana revolving one which the trapeziod method did in the nonlinear case earlier.This shows the fourth order Runge-Kutta method to be a more accurate andeffecitve method.

Using thefourth order Runge Kutta method I examined the damped pendu-lum. The following are graphs of the linear fourth order Runge-Kutta methodversus the nonlinear fourth order Runge-Kutta method for the same dampingcoefficiants and initial conditions.

8

Page 9: Motion of a Simple Pendulum - Trinity College, Dublinsmurray/Pendulumwriteup.pdf · In this lab the motion of a simple pendulum was found computationaly. Both lin- ... where g is

(a) θ = 0.5, ω = 0 (b) θ = 0, ω = 2

(a) θ = 3.124, ω = 0 (b) θ = 1.5, ω = 2

Here in graph a, the linear and nonlinear methods overlap, which is to beexpected as θ is small so the linear approximation works well.

In graph b, the linear doesnt approximate the nonlinear case as well, butthis is again expected since θ is larger than before.

In graph c, the linear and nonlinear results dont match up well at all. Thisis because θ is now very large and the linear approxiation doesnt work for largeθ .

In graph d, the linear result is that the pendulum dampens as normal, butthe nonlinear result is that the pendulum makes one full revolution before itsettles back into regular damped oscillations now about 2π since it has madethat one revolution.

In the last two cases it is noted that the nonlinear result after some timesettles down into a pattern like the linear result ( although shifted time ).This is expected as when the oscillations are damped down to between lowenough values for θ the linear approximation will work again. (This matching

9

Page 10: Motion of a Simple Pendulum - Trinity College, Dublinsmurray/Pendulumwriteup.pdf · In this lab the motion of a simple pendulum was found computationaly. Both lin- ... where g is

is illustrated in diagram a).

Here I examined the damped driven pendulum. With k = 0.5 , b = 1, Ω = 0.6667, a range of starting values for θ and ω and values for A of0.9, 1.07, 1.35, 1.47, 1.50. the results are as shown in the graphs.

(a) θ = −2, ω = −0.2, A = 0.9 (b) θ = −1.3, ω = 0.4, A = 1.07

(a) θ = −1.7, ω = 0.2, A = 1.35 (b) θ = −2.7, ω = −0.3, A = 1.47

10

Page 11: Motion of a Simple Pendulum - Trinity College, Dublinsmurray/Pendulumwriteup.pdf · In this lab the motion of a simple pendulum was found computationaly. Both lin- ... where g is

(a) θ = 0, ω = 0, A = 1.50

Here graph a shows periodic motion.Graph b shows period doubling.Graph c shows the pendulum rotating, again its periodic motion and the

period has a small oscillation in it as the pendulum oscillates once back andforward over roughly θ = 1.

Graph d shows period quadrupling.Graph e shows chaotic motion, there is no period, the graph itself is shwing

the motion of the pendulum through the first 100 periods of the driving force,disregarding the first 40. This is not a transient period. I took a much largertime sample of 10000 periods and still the pendulum did not settle into someperiodic motion. This is chaotic motion.

Conclusions

It was seen how methods such as the simple euler method, the trapezoid ruleand the fourth order Runge-Kutta method could be used to integrate out themotion of the simple pendulum when there wasnt an anlyitical solution. Themotion of the pendulum from the nonlinear equation vs the linear equation wasanalysed for various initial conditions. The damped driven pendulum was alsoanalysed and period doubling, quadrupling and chaotic motion was observed.

11