Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
References:
1.http://en.wikipedia.org/wiki/Double_pendulum
A S Kompaneyets
, pages 29, 61
An Introduction to Computer Simulation Methods: Applications to Physical Systems (3rd Edition) by Harvey Gould, Jan
Abstract : A numerical code is developed to integrate the two coupled equations of motion describing the double pendulum
motion.
The masses m1 , m2 are held by rigid mass less chords L1 and L2 . We assume a friction free motion.
To write the Lagrangian start with the expression for the kinetic energy.
(1)
(2)
, 1(t) = d1 /dt ,
(3)
v2 = (dx2/dt , dy2/dt) = (L1 1 cos1 + L22 cos2 , L1 1sin1 +L22 sin2) ,2(t) = d2 /dt . (4)
The square of the velocities are
v12 = L1212
v22 = L1212 + L2222 + 2L1L2 1 2 cos(1- 2 )
(5)
. (6)
. (7)
. (8)
. (9)
, i=1,2
. (10)
MAXIMA code
MAXIMA code
, (13)
. (14)
(11)
(12)
( 16 )
***********
(17)
,
. (18)
(21)
d2 2 /dt2 = G2(1, 2 , 1 , 2 )
(22)
(23)
(24)
In the example given below the initial conditions will always be 1 (0) = 0 , d1(0)/dt=0 ; 2 (0) 0 ,
d2 (0)/dt =0. The only non zero initial condition is the displacement of the second pendulum.
Unless special cases are assumed there will be various time scales .
The time scale arise from possible combinations of the ratio of the masses and the length of the pendulum,
tscale ~ ( mi/mj ) 1/2 [ Lk2 /( Ln g) ]1/2
. (25)
(26)
The choice of t in the numerical integration has to be much smaller than the smallest time scale.
EXAMPLES:
Parameters and initial conditions
1. m1 = m2 = .2 kg , L1 = L2 = 1. , 1 (0)= 0. , 2 (0) = /4 , 1 (0)= 0, 2 (0)= 0 .
Fig 1. 1 and 2 .
FORTRAN code
c Double pendulum 30 jun 2011
real L1, L2 ,m1,m2
data g,z10,z11,z20/9.80,0.,0.,.4/
data w1,w2/0.,0./
data m1,m2,L1,L2/.3,.3,1.,1./
dLdz1(z1,z2,w1,w2)=m2*w1*w2*L1*L2*sin(z2-z1)-g*L1*(m1+m2)*sin(z1)
dLdz2(z1,z2,w1,w2)=-m2*w1*w2*L1*L2*sin(z2-z1)-g*m2*L2*sin(z2)
F1(z1,z2,w1,w2)= dLdz1(z1,z2,w1,w2)+ m2*w1*L1*L2*(w1 - w2)
$ *sin(z1- z2)
F2(z1,z2,w1,w2)=dLdz2(z1,z2,w1,w2)+m2*w1*L1*L2*(w1-w2)*sin(z1-z2)
den(z1,z2)=m2*L2**2*(m1*L1**2+m2*L1**2)- (m2*L1*L2*cos(z1-z2))**2
G1(z1,z2,w1,w2)=(F1(z1,z2,w1,w2)*m2*L2**2 - F2(z1,z2,w1,w2)*m2*L1*
$ L2*cos(z1- z2))/den(z1,z2)
G2(z1,z2,w1,w2)=((m1*L1**2+m2*L1**2)*F2(z1,z2,w1,w2) -m2*L1*L2*
$ cos(z1- z2)*F1(z1,z2,w1,w2) )/den(z1,z2)
pi=2.*asin(1.)
z21=z20
ts1=((m1/m2)*(L1**2/(L2*g)))**.5
ts2=((m2/m1)*(L2**2/(L1*g)))**.5
tsmall=amin1(ts1,ts2)
tlarge=amax1(ts1,ts2)
dt=tsmall/100.
tf=6.*tlarge
nstep=int(tf/dt)
kp=int(float(nstep)/100.)
kount=kp
print*,'tf,dt,nstep=',tf,dt,nstep
print*,' '
print 100,0.,z10,z20
do 10 i=2,nstep
t=dt*float(i)
z12=2.*z11-z10+dt**2*G1(z11,z21,w1,w2)
z22=2.*z21-z20+dt**2*G2(z11,z21,w1,w2)
c print*,'dt,z11,z21=',dt,z11,z21
c print*,'G1,G2=',G1(z11,z21,w1,w2),G2(z11,z21,w1,w2)
if(i.eq.kount)then
print 100,t,z12,z22
kount=kount+kp
endif
w1=(z12-z11)/dt
w2=(z22-z21)/dt
z10=z11
z11=z12
z20=z21
z21=z22
10 continue
100 format('t,theta1(rad),theta2=',3(3x,e10.3))
stop
end