# simplified double pendulum c=cos(t1-t2) f1=-sin(t1-t2)*t2p^2-2*g*sin(t1)/l f2=-sin(t2-t1)*t1p^2-g*sin(t2)/l t1'=t1p t2'=t2p t1p'=(f1-c*f2)/(2-c^2)-nu*t1p t2p'=(2*f2-c*f1)/(2-c^2)-nu*t2p par g=9.8,l=1,nu=0.001 init t1=2.5,t2=2 @ meth=qualrk,tol=1e-10,atol=1e-10,total=100,maxstor=100000 @ bound=100000 @ xhi=100,ylo=-20,yhi=20,yp=t2 pe=-g*l*(2*cos(t1)+cos(t2)) ke=.5*l*l*(2*t1p^2+t2p^2+2*cos(t1-t2)*t1p*t2p) # Reality check - total energy should be conserved if nu=0 aux te=ke+pe done Run XPP with this file dp.ode Initialconds Go Window Fit Viewaxes Toon In the Toon window File choose dp.ani In Toon window - click Go to see the pendulum Back in XPP you can play with initial conditions, or friction (nu) etc Back in the toon window, after you simulate in XPP, click on Reset and then Go