Beruflich Dokumente
Kultur Dokumente
RojaNunna
Math53:Chaos!
ProfessorAlexanderBarnett
DartmouthCollege
Fall,2009
Aplanardoublependulumisasimplemechanical
systemthathastwosimplependulaattachedend
toendthatexhibitschaoticbehavior.Theaimof
thisprojectwillbetonumericallyanalyzethe
dynamicsofthedoublependulumsystem.First,the
physical system is introduced and a system of
coordinates is fixed, and then the Lagrangian and
the Hamiltonian equations of motions are derived.
Wewillfindthatthesystemisgovernedbyasetof
couplednonlinearordinarydifferentialequations
andusingthese,thesystemcanbesimulated.
FinallyweanalyzePoincarsections,thelargest
lyapunovexponent,progressionoftrajectories,and
changeofangularvelocitieswithtimeforcertain
systemparametersatvaryinginitialconditions.
Systemofcoordinates
ThedoublependulumisillustratedinFig.1.Itis
convenienttodefinethecoordinatesintermsof
theanglesbetweeneachrodandthevertical.In
thisdiagramm1,L1,and1representthemass,
lengthandtheanglefromthenormaloftheinner
bobandm2,L2,and2standforthemass,length,
andtheanglefromthenormaloftheouterbob.To
simplyournumericalanalysis,letusassumethat
m1=m2=mandL1=L2=l.Thatis,weconsidertwo
identicalrodswith(
).Assumethat
massesofrodscanbeneglectedbuttheirmoment
ofinertiashouldbeincludedtobetterreflectthe
physicalsystemtheyrepresent1.
Figure1:Schematicrepresentationofthe
constructionofasimpledoublependulumwhere
m1,L1,and1representthemass,lengthandthe
anglefromthenormaloftheinnerbobandm2,L2,
and2standforthemass,length,andtheangle
fromthenormaloftheouterbob2.
Equationsofmotion
Now,byresolvingthesequantitiesontohorizontal
andverticalcomponents,weobtainthepositionof
thecenterofmassofthetworods,where(x1,y1)
arethepositionoftheinnerboband(x2,y2)isthe
positionoftheouterbob.
(1)
sin
sin
sin
cos
cos
TheLagranianisgivenby
(2)
(3)
cos
(4)
(5)
(6)
Thefirsttermisthelinearkineticenergyofthe
centerofmassofthebodiesandthesecondtermis
therotationalkineticenergyaroundthecenterof
massofeachrod.Thelasttermisthepotential
energyofthebodiesinauniformgravitational
field.
Plugginginthecoordinatesabove,weobtain
4
3
cos
(7)
3
Thereisonlyoneconservedquantity(theenergy),
andnoconservedmomenta.Thetwomomenta
maybewrittenas
8
3 cos
(8)
2
3 cos
(9)
Theseexpressionsmaybeinvertedtoget
(10)
(11)
Theremainingequationsofmotionformomentum
are
sin
3
(12)
sin
(13)3
Letsassumenowthat
1.Thisgivesusa
setoffourequationsthatcanbeusedtosimulate
thebehaviorofthedoublependulum
6
(14)
6
sin
(15)
3
(16)
sin
(17)
Theconservedquantity,energyfunction,isgiven
by
2
(18)
Substituitingtheabovesolvedequationsfor and
,weobtain
cos
2
Again,whenm=l=1,
(19)
2
4
(20)
Simulationofthemotionforvariousinitial
conditionscanbeperformedbyrunningthe
attachedMATLABcodethatusesode45.
SomeTheory
Letusintroduceanewconceptofquasiperiodic
motion.Roughlyspeaking,theyrefertoalmost
periodicmotion.Moremathematically,itcanbe
thoughtofas5thetypeofmotionexecutedbya
dynamicalsystemcontainingafinitenumberof
incommensurablefrequencies.
Fromequations14to17,weseethatthedynamics
ofadoublependulumcanbedescribedwith4
variables,thetwoanglesandtheircorresponding
(angular)velocities,whichspanthefour
dimensionalphasespaceofthesystem6.Sincethe
doublependulumisahamiltoniansystem,total
energyisconserved(equation20)andthisreduces
thefourdimensionalphasespacetoathree
dimensionalmanifold.Further,TheKAMtheorem
statesthatifahamiltoniansystemissubjectedtoa
weaknonlinearperturbation,someoftheinvariant
torithathavesufficientlyirrationalfrequencies
survive.Inotherwords,themotioncontinuestobe
quasiperiodic7.KAMtellsusthatatlowerenergies,
thefunctionisintegrable(ithasasmanyconserved
quantitiesastherearedegreesoffreedominthe
system)8.Athighenergythependulumbehaves
likeasimplerotor,withthesystemrotatingrapidly
inastretchedcofiguration(1=,2=0).Inthis
casethekineticenergytermsintheLagrangian
dominatethepotentialenergytermsandmaybe
describedbysettingg=0intheequationsof
motion.Thetotalangularmomentumisconserved,
becauseintheabsenceofgravity,thereisno
torqueonthependulum.Theresultingmotionof
thesystemisregular(nonchaotic),becausea
systemwithtwodegreesoffreedomandtwo
constraints(conservationoftotalenergyandtotal
angularmomentum)cannotexhibitchaos.It
follows,forexample,thatthedoublesquare
pendulumwouldnotexhibitchaosifinstalledon
thespacestation9.Lowerenergiesandhigher
energies=periodicmotion.Fromthistheoretical
evidence,wehypothesizethatthebehaviorofa
doublependulumvariesfromregularmotionat
lowenergies,tochaosatintermediateenergies,
andbacktoregularmotionathighenergies10.
Poincare
Poincaresectionsallowfastandinformativeinsight
intothedynamicsofthedoublependulum.The
differenttypesofmotionappearasfinitenumber
ofpointsforperiodicorbits,curvefillingpoints
(invariantcurves)forquasiperiodicmotionand
areafillingpointsforchaotictrajectories.
WecanconstructatwodimensionalPoincare
sectionbylookingatthetrajectoryonlyatthose
pointswhentheouterpendulumpassesthe
verticalposition,thatis2=0.Equation20then
yieldsaquadraticequationfor2,withsolutions
1
(21)
Wecannowplota( , )inthephasespaceof
theinnerpendulumwhenthetwoconditions
0and
0arefulfilled.
LargestLyapunovExponent
Sensitivedependenceoninitialconditionssmall
separationsbetweenarbitrarilycloseinitial
conditionsareamplifiedexponentiallyintimeis
thehallmarkofchaos.Theunderlyingcauseofthis
behavior,namelytheexponentialgrowth,canbe
numericallyandanalyticallyevaluatedusing
lyapunovexponents.Largestlyapunov
exponents11,asiteffectivelygivesusthe
informationonthedivergenceoftwoclose
trajectories.Wecanusethesamefirstorder
equationsusedintheMATLABsimulationto
evaluatetheexponent.Themethodtocalculate
thelyapunovexponentistofirstplotthenatural
logarithmoftheseparationbetweenthetwo
closelylaunchedtrajectoriesagainsttimeandthen
findtheslopeoftheregionwhereitisincreasing.
Asusual,positivelyapunovexponentsare
indicativeofchaoticbehavior.
Otherinformativeplots
Wecanalsoplotthefourvariablesthat
characterizethesystemagainsteachothertogeta
qualitativesenseofthebehaviorofthesystem.Itis
moredifficulttogaugewhatishappeningwiththe
dynamicsofthesystemwithsuchplotsbutthey
arestillindicativeofperiodicversuschaotic
behavior.
Nowwehaveallthetoolstolookatsome
simulationsandseeifthetheoryfitstheobserved
behavior.
Simulations
Letusstartwithlowenergyconditions.Usingthe
Hamiltonian,theenergycaneasilybecalculatedin
Joules.Whenwehaveinitialconditions=y0=
, ,
,
=[0.2,0.2828,0,0],theenergy=
0.7809J.Atthislowenergyweexpectedperiodic
behavior.Theattachedcodetitledhamiltonian.m
returnsthisvalueforaninputofy0.
(Figures2,3,4,5,6areinAppendixA)Theperiodic
trajectoryoftheouterbobisclearfromfigure2a,
thePoincaresectionsarepresentedinfigure2b
andshowafinitenumberofpointsthatgrow
outwardswithtimebutformageneralpearshape.
Theplotin3Dformsapearshapewhenrotated
aboutthex1axis.Whenasecondtrajectoryis
launchedatadistanceof109fromthisinitial
condition,weseefromfigure2dthattheymove
togetherindicatingthatthereisnochaos.When
thelyapunovgraphisplotted,itisclearthatthe
lyapunovexponentisnegative(=3.426)andhence
thesystemisnotchaotic.Theangularvelocitiesof
theinnerandouterbobsareinphaseandperiodic
furtherconfirmingthattheseinitialconditionsat
lowenergyareindicativeofthenonchaotic
regime.
Asweincreasetheenergyto1.2807Jwiththeintial
conditionsy0=[0.7,0.3825,0,0],weenterthequasi
periodicregime.Theperiodictrajectoryofthe
outerbobisinfigure3aandweseethattheinner
andtheouterbobareoutofphase(also
exemplifiedintheangularvelocitiesgraphin3d.
Figure3eshowsthattwocloselylaunched
trajectoriesdonotdivergefromeachother.Using
thisdistanceseparation,whenthelyapunovgraph
wasgeneratedin3e,weseethatthelyapunov
exponentdoesnotremainentirelynegativeand
startstobeginincreasingtopositivevalueswith
time.Theaveragelyapunovexponentis1.203
whichishigherthanfortheperiodiccondition.
Whentheenergyisfurtherincreasedtobe29.4J
withinitialconditionsy0=[,,0.5,0].Werepeat
thesameprocessandfindaaveragepositive
lyapunovexponentof1.906(figure4e).This
averagenumberwasobtainedbycalculatingthe
averageoverarangeofinitialconditionsaround
thisy0(figure4f).Weseeinfigure4athatthepath
oftheouterbobisrandomandunpredictable.The
Poincaresectionisclearlyareafillingandthetwo
closelylaunchedtrajectories(withaninitial
separationof109)startofftogetherbutmove
awayfromeachother.Theangularvelocitieswhich
arequalitativeindicators,alsoshowthatthereisno
regularbehavior.Alloftheseclearlyindicatethatat
theseenergies,thesystemischaotic.
Sofarwefoundthatasweincreaseenergy,the
systemmovesfrombeingperiodictoquasiperiodic
tochaos.Now,ifweincreasetheenergyevenmore
toreach104.25Jwithinitialconditionsy0=[,0,
0.5,0.5],weseethequasiperiodicstateagain!
Clearly,from5dthetrajectorieshavenotdiverged
fromeachother.Also,thereisadecreaseinthe
lyapunovexponentto0.4320.Theangular
velocities(figure5c)areoutofphasetogether.The
trajectoryinfigure5aisacertainindicationof
quasiperiodicmotion.AlthoughthePoincare
sectionsarealittledifficulttounderstand,the
othergraphsareindicativeofquasiperiodic
behaviorattheseenergies.
Letustakealookatfigure6,thathasother
informativeplotsofthevariablesplottedagainst
eachother.Thereisqualitativetrendindicatingthe
systemstartsouttobeperiodic,inthesensethat
theshapeofthecurvescanbepredictedforlater
times,tochaoticunpredictablebehaviorandfinally
backtoshapesresemblingperiodicity.Ineachof
them,thetopleftistheanglesoftheinnerand
outerbob,toprighthastheangularvelocitiesof
theinnerandtheouterbob.Bottomandleftand
rightshowtheangleversusangularvelocityofthe
innerbobandtheouterbobrespectively.
Thegraphsweregeneratedusingthecodes
PoincareTrajecAngleEnergy.mandcrudelyap.m.
TheyneedHamiltonian.m,doublependulum2.m
andzerocross2.mtowork.Allthecodeisattached
inAppendixB.
AppendixA:Figures
Poincare section (sin(x 2)=0, increasing)
trajectory
0.58
-1.6
b)
a)
0.56
-1.7
-1.8
0.54
x3
0.52
-2
0.5
-2.1
0.48
-2.2
-2.3
0.46
-0.4
-0.3
-0.2
-0.1
0
position
0.1
0.2
0.3
-0.1
0.4
-0.05
0
x1
0.05
0.1
Angular velocities
1.5
d)
c)
0.55
0.5
0.5
x4
velocity
-1.9
-0.5
0.45
1.2
-1
1.1
4
1
-1.5
x3
x1
10
lyapunov exponent
e)
-1.94
f)
-1
-2
-1.95
-3
-1.96
-4
-5
-1.97
-6
-1.98
-7
-8
-1.99
-9
-2
10
-10
10
Figure2:y0=[0.2,0.2828,0,0]producesperiodicmotion.a)Trajectoryoftheouterbob;b)2DPoincaremap
forthesectionwhentheouterbobishangingverticallyi.e2=0;c)3DPoincaremapwhenthepositionofthe
outerbobisatzeroi.esin2=0;d)angularvelocitiesoftheouterandtheinnerbobagainsttime;e)Trajectories
oftwocurvesatadistanceof109betweenthem;f)Illustratesthenegativelyapunovexponent.
0.32
a)
-1.8
b)
0.3
0.28
-1.85
0.26
-1.9
x3
0.22
-2
0.2
-2.05
0.18
0.16
-2.1
0.14
-2.15
-0.25
-0.2
-0.15
-0.1
-0.05
0
0.05
position
0.1
0.15
0.2
-0.06
0.25
-0.04
-0.02
0
x1
0.02
0.04
0.06
Angular velocities
0.6
d)
c)
0.4
0.3
0.2
0.25
x4
velocity
0.24
-1.95
0.2
-0.2
0.15
-0.4
-0.2
-0.6
6
4
-0.4
-0.6
x3
2
0
-0.8
x1
10
lyapunov exponent
2
f)
e)
-1.91
0
-1.92
-1
-1.93
-1.94
-2
-1.95
-3
-1.96
-4
-1.97
-5
-1.98
-6
-1.99
-2
-7
0
10
10
Figure3:y0=[0.2,0.2828,0,0]producesquasiperiodicmotion.a)Trajectoryoftheouterbob;b)2DPoincare
mapforthesectionwhentheouterbobishangingverticallyi.e2=0;c)3DPoincaremapwhentheposition
oftheouterbobisatzeroi.esin2=0;d)angularvelocitiesoftheouterandtheinnerbobagainsttime;e)
Trajectoriesoftwocurvesatadistanceof109betweenthem;f)slowlyincreasinglyapunovexponent.
Poincare section (sin(x 2)=0, increasing)
trajectory
2
a)
b)
0.5
-10
x4
velocity
1.5
-20
-30
-0.5
-40
-1
30
20
-1.5
6
10
4
0
-2.5
-2
-1.5
-1
-0.5
0
0.5
position
1.5
-10
2.5
x3
x1
Angular velocities
10
c)
d)
1.5
0.5
2
0
-2
-0.5
-4
-1
-6
-1.5
-8
-10
10
-2
10
lyapunov exponent
22
e)
20
f)
18
2
16
1.5
14
12
10
0.5
8
0
6
4
10
-0.5
10
20
30
40
50
60
70
80
90
100
Figure4:y0=[,,0.5,0]produceschaos!a)Trajectoryoftheouterbob;b)2DPoincaremapforthesection
whentheouterbobishangingverticallyi.e2=0;c)angularvelocitiesoftheouterandtheinnerbobagainst
time;d)Trajectoriesoftwocurvesatadistanceof109betweenthem;e)positivelyapunovexponent;f)
averagelyapunovexponentforvariousinitialconditions.
trajectory
a)
1.5
b)
0
1
-10
-20
x3
v elocity
0.5
-0.5
-30
-1
-40
-1.5
-50
-2.5
-2
-1.5
-1
-0.5
0
0.5
position
1.5
2.5
-500
-400
-300
-200
-100
x1
Angular velocities
Trajectories of two intial points with a distance 10- 9
3.5
2
c)
d)
1.5
2.5
2
1.5
0.5
0.5
-0.5
0
-1
-0.5
-1.5
-1
-1.5
-2
10
10
12
14
16
18
20
lyapunov exponent
8
e)
f)
0.8
0.6
2
0.4
0
0.2
-2
0
-4
10
-0.2
10
20
30
40
50
60
70
80
90
100
Figure5:y0=[,0,0.5,0.5]producesquasiperiodicmotion.a)Trajectoryoftheouterbob;b)2DPoincaremap
forthesectionwhentheouterbobishangingverticallyi.e2=0;c)angularvelocitiesoftheouterandthe
innerbobagainsttime;d)Trajectoriesoftwocurvesatadistanceof109betweenthem;e)slightlypositive
lyapunovexponent;f)averagelyapunovexponentforvariousinitialconditions.
angles
angular velocities
angles
angular velocities
0.4
0.2
0.4
0.2
0.2
0.1
0.2
0.1
-0.2
-0.1
-0.2
-0.1
-0.4
-0.4
-0.2
0.2
0.4
-0.2
-0.4
-0.2
0.2
-0.4
-0.2
0.4
-0.1
0.1
0.2
-0.2
-0.2
0.2
0.2
0.2
0.2
0.1
0.1
0.1
-0.2
-0.1
-0.1
-0.1
-0.2
0.2
0.4
-0.2
-0.4
-0.2
0.2
-0.2
-0.2
0.4
-0.1
0.1
0.2
0.1
0.2
0.4
-0.4
-0.4
-0.1
-0.2
-0.4
-0.2
0.2
0.4
angles
angular velocities
15
angles
angular velocities
600
15
10
400
10
-1
200
-5
10
15
20
-2
-1
10
15
20
-2
-5
10
20
40
60
0
-5
15
15
10
20
40
10
10
-5
60
200
400
600
Figure6:Ineachsquare,thetopleftistheanglesoftheinnerandouterbob,toprighthastheangularvelocitiesofthe
innerandtheouterbob.Bottomandleftandrightshowtheangleversusangularvelocityoftheinnerbobandtheouter
bobrespectively.Thetopleftsquareshowsperiodicbehavior,thetoprightsquareindicatesquasiperiodicakaalmost
periodicbehavior,thebottomleftsquarehasthechaoticsystemdepictedandthebottomrightsquarestartstohaving
resemblancestoperiodicbehavior.
AppendixB:MATLABcodes
Animationofthependulum
doublependulumAnimation.m
% modified from http://math.la.asu.edu/~kawski/MATLAB/matlab.html
%comments by Roja
function out=dpend()
if nargin < 5
n=3;
end
%declare variables
global m1 m2 L1 L2 g;
m1 = 2;
m2 = 1;
g = 1;
L1 = 1;
L2 = sqrt(3);
dt = 0.1;
y0 = [-pi 0 -pi 2*rand(1,1)-1];
t0 = 0;
twin=30;
r1 = (L1+L2)/20*sqrt(m1/(m1+m2));
r2 = (L1+L2)/20*sqrt(m2/(m1+m2));
%size the animation window
LL = 1.2 * ( L1 + L2 );
% re-use data while disk is being plotted
bx = cos(pi*[0:0.1:2]);
by = sin(pi*[0:0.1:2]);
% initial positions (delete previous images later)
x1= L1*sin(y0(1));
y1=-L1*cos(y0(1));
x2=x1+L2*sin(y0(3));
y2=y1-L2*cos(y0(3));
b4=plot([0,x1],[0,y1],'k-','LineWidth',2);
hold on
b3=plot([x1,x2],[y1,y2],'k-','LineWidth',2);
b1=fill(x1+r1*bx,y1+r1*by,'magenta');
b2=fill(x2+r2*bx,y2+r2*by,'black');
% scale the window to fit the double pendulum
axis([-LL LL -LL LL])
for N=[1:1000]
% save the old angles and positions
posold=[x1 y1 x2 y2]';
yold=y0;
% solve the systems of odes until next frame
[t,y]=ode45('doublependulum2',[t0,t0+dt],y0,[],9.8,1,1,1,1);
% keep the new angles and delete the old ones
y0=y(size(y,1),:);
clear y
clear t
% translate angles into [-pi,pi]
y0(1)=mod(y0(1)+pi,2*pi)-pi;
y0(3)=mod(y0(3)+pi,2*pi)-pi;
t0=t0+dt;
% delete the old pictures of the pendulum
% calculate the new positions
x1 =
L1*sin(y0(1));
y1 =
- L1*cos(y0(1));
x2 = x1 + L2*sin(y0(3));
y2 = y1 - L2*cos(y0(3));
% plot the path of the pendulumsin last time interval (overlay)
plot([posold(1) x1],[posold(2) y1],'magenta');
plot([posold(3) x2],[posold(4) y2],'black');
% plot the images of the pendulums at new positions (overlay)
set(b4,'xdata',[0,x1],'ydata',[0,y1]);
set(b3,'xdata',[x1,x2],'ydata',[y1,y2]);
set(b1,'xdata',x1+r1*bx,'ydata',y1+r1*by);
set(b2,'xdata',x2+r2*bx,'ydata',y2+r2*by);
drawnow
pause(0.01)
end
figure(myfig);
pause
close(myfig)
Systemofequations
Doublependulum2.m
%define a function that calculates the dynamics of the double pendulum
%flag determines initial positions and velocities of the inner and outer
%bob. Equations 14 to 17
function xprime=doublependulum2(t,x,flag,g,l1,l2,m1,m2)
xprime=zeros(4,1);
xprime(1) = 6*(2*x(3)-3*cos(x(1)-x(2))*x(4))/(16-9*cos(x(1)-x(2))^2);
xprime(2) = 6*(8*x(4)-3*cos(x(1)-x(2))*x(3))/(16-9*cos(x(1)-x(2))^2);
xprime(3) = -(xprime(1)*xprime(2)*sin(x(1)-x(2))+3*g*sin(x(1)))/2;
xprime(4) = -(-xprime(1)*xprime(2)*sin(x(1)-x(2))+g*sin(x(2)))/2;
end
CalculatingEnergyofthefunction
Hamiltonian.m
DefiningtheconstantsurfaceforthePoincaresection
Zerocross2.m
Producingthetrajectoryoftheouterbob,Poincaresection,angularvelocitygraphandenergyofthesystem
PoincareTrajecAngleEnergy.m
clear
%Code mainly adapted from Alexander Barnett
%declare time step
T = 10;
%y0 = [0;0;-2;0]; % close to regular
%y0 = [pi;pi;0;0];
% y0 = [pi;pi;.5;0]; % chaotic
% y0=[0.5233;0;0.5233;0]%periodic
y0 = [0.2,0.2828,0,0]%perfect periodic with energy = 0.7809
%y0 = [0.2,-0.2828,0,0]%perfect quasiperiodic with energy = 0.7809
%y0 = [27.8;0;1.22;2.62] %perfect KAM scenario
%y0 = [0,0,2,20]
%y0 = [0,0,1,20];
y0 =[pi;0;.5;.5];%high energy
s=ode45(@doublependulum2,[0,T],y0,[],0,1,1,1,1);
t = 0:0.01:T; x = deval(s,t)';
x1=sin(x(:,1));
y1=-cos(x(:,1));
x2=x1+sin(x(:,2));
y2=y1-cos(x(:,2));
figure; plot(x2,y2); axis equal; xlabel('position');ylabel('velocity');title
('trajectory')
tmax = 1e2;
% max time to wait until next intersection
ns = 1000;
% how many intersection (iterations of P map)
tp = nan*(1:ns); yp = nan*zeros(numel(y0),ns); yi = y0; % init arrays
figure;
for n=1:ns
s = ode45(@doublependulum2, [0, tmax], yi,
odeset('Events',@zerocross2,'abstol',1e-9),0,9.8,1,1,1,1);
if isempty(s.xe), disp('no intersection found!');
else tp(n) = s.xe(end); yi = s.ye(:,end); yp(:,n) = yi;
%plot3(mod(yi(1),2*pi),yi(3),yi(4),'+'); hold on; if mod(n,10)==0, drawnow; end
% note it's in 3d now
plot(yi(1),yi(4));hold on; if mod(n,10)==0, drawnow; end
end
end
xlabel('x_1'); ylabel('x_3'); zlabel('x_4'); axis vis3d;
title('Poincare section (sin(x_2)=0, increasing)');
figure;
plot(t,x(:,3),'magenta',t,x(:,4),'black');title('Angular velocities');
energy = hamiltonian(y0)
Calculatesthelyapunovexponent,theaveragelyapunovexponentandtracestheseparationofclosetrajectories
Crudelyap.m
clear
nruns =100;
%for calculating average later
h = zeros(1,nruns);
%indexing of h
k = 1;
for j=1:nruns
% y0 = [pi+0.1*rand(1);pi;.5;0];
% y0 = [0+0.1*rand(1);0;-2;0];
%y0 = [pi;pi;10.515;-2.17];%periodic with T = 0.5
%y0 = [];%quasiperiodic;
y0 = [pi+0.1*rand(1);pi;0.5;0];%chaotic
%y0 = [pi;pi;0;0];
%y0 = [0;0;-2;0];%close to regular
%y0 = [27.8;0;1.22;2.62];
%y0 = [pi;0;0.5;0.5];
%y0 = [0;0;2;20];
%y0
%y0
%y0
%y0
T =
= [pi;0;5;5];%high energy
= [0.2;0.2828;0;0];%perfect periodic with energy = 0.7809
= [0.2+0.1*rand(1);-0.2828;0;0];
= [0.2;-0.2828;0;0];%perfect quasiperiodic with energy = 0.7809
20;
o = odeset('abstol',1e-14);
s=ode45(@doublependulum2,[0,T],y0,o,0,1,1,1,1); % note changes
eps = 1e-9;
s2 = ode45(@doublependulum2,[0,T],y0+[eps;0;0;0],o,0,1,1,1,1); % note changes
t = 0:0.01:T; x = deval(s,t)';xe = deval(s2,t)';
x1=sin(x(:,1));
y1=-cos(x(:,1));
x2=x1+sin(x(:,2));
y2=y1-cos(x(:,2));
xe1 = sin(xe(:,1));
ye1=-cos(xe(:,1));
xe2 = xe1+sin(xe(:,2));
ye2= ye1-cos(xe(:,2));
%store the size
N = numel(ye2);
%figure; plot(t, [y2 ye2], '-');title('Trajectories of two intial points with a
distance 10^-9')
logsep = zeros(1,N);
%loop fills matrix logsep with natural log of the changing separation
%between the initial trajectories
for i = 1:N
logsep(i) = (log(abs(y2(i)-ye2(i)))-log(eps));
end
%figure; plot(t,logsep);title('lyapunov exponent');
t1=5;
t2=0.7;
%stores the exponent in a matric
h(k) = (logsep(t1/0.01)-logsep(t2/0.01))/(t1-t2);
k=k+1;
end
figure;
%average lyapunov exponent
plot(1:j,h)
title('average lyapunov exponent');
Graphscorrespondingtotheotherinformativegraphssectionsoftheinputvariablesplottedagainsteachother
Equilibria.m
clear
T = 10;
%y0 = [0;0;0;10]; %really good
%y0 = [pi;pi;0.5;0];
%y0 = [0;0;-2;0];
%y0=[0;0;2;20];
%y0 = [27.8;0;1.22;2.62] %perfect KAM scenario
y0 = [0.2,-0.2828,0,0];
y0 = [pi;0;.5;.5]
%y0 = [pi;pi;0.5;0]
s=ode45(@doublependulum2,[0,T],y0,[],0,1,1,1,1);
t = 0:0.01:T; x = deval(s,t)';
%find energy for the inital conditions
energy = hamiltonian(y0)
%creates a plot with four figures of the variables plotted against each
%other
figure;
subplot(222)
plot(x(:,3),x(:,4));title('angular velocities')
subplot(221)
plot(x(:,1),x(:,2));title('angles')
subplot(223)
plot(x(:,1),x(:,3));title('positions and momentum of 1')
subplot(224)
plot(x(:,2),x(:,4));title('positions and momentum of 1')
EndnotesandReferences
Heyl,JeremyS."TheDoublePendulumFractal."DepartmentofPhysicsandAstronomy.UniversityofBritishColumbia,11
Aug.2008.Web.4Dec.2009.<http://tabitha.phas.ubc.ca/wiki/images/archive/3/37/20080811183757!Double.pdf>.
2
"DoublePendulumExercises."Areyousureyouwanttolookatthis?Web.04Dec.2009.
<http://pages.physics.cornell.edu/~myers/teaching/ComputationalMethods/ComputerExercises/DoublePendulum/double
pendulum.html>.
3
Haar,D.Ter.ElementsofHamiltonianMechanics(InternationalSeriesonNuclearEnergy).NewYork:PergamonPr,1971.
Print.
4
http://scienceworld.wolfram.com/physics/DoublePendulum.html
5
"DoublePendulumfromEricWeisstein'sWorldofPhysics."ScienceWorld.Web.04Dec.2009.
<http://scienceworld.wolfram.com/physics/DoublePendulum.html>.
6
Stachowiak,Tomasz,andToshioOkada."Anumericalanalysisofchaosinthedoublependulum."ScienceDirect(2006).
Chaos,solitionsandFractals.Www.elsevier.com/locate/chaos,10Aug.2005.Web.4Dec.2009.
<http://www.sciencedirect.com/science?_ob=MImg&_imagekey=B6TJ44H7T0J76
W&_cdi=5300&_user=4257664&_orig=search&_coverDate=07%2F31%2F2006&_sk=999709997&view=c&wchp=dGLbVlb
zSkWz&_valck=1&md5=ec827bbbd88de6e08e02922a969c6ca0&ie=/sdarticle.pdf>.
7
Poschel,Jurgen."ClassicalKAMTheorem."Lecture.Publikationen.Proc.Symp.PureMath,Dec.2000.Web.4Dec.2009.
<http://www.poschel.de/pbl/kam1.pdf>.
8
Barnett,Alexander."Usingode45forpoincaresection."Messagetotheauthor.29Nov.2009.Email.
9
Rafat,M.Z.,M.S.Wheatland,andT.R.Bedding."Dynamicsofadoublependulumwithdistributedmass."American
JournalofPhsyics(2006).UniversityofSydney,2006.Web.4Dec.2009.
<http://www.physics.usyd.edu.au/~wheat/preprints/DynamicsDoublePendulum.pdf>.
10
Chaos:AProgramCollectionforthePCByH.J.Korsch,HansJrgJodl,T.Hartmann,Pg.91
11
Rafat,M.Z.,M.S.Wheatland,andT.R.Bedding."Dynamicsofadoublependulumwithdistributedmass."American
JournalofPhsyics(2006).UniversityofSydney,2006.Web.4Dec.2009.
<http://www.physics.usyd.edu.au/~wheat/preprints/DynamicsDoublePendulum.pdf>.