function xdot = double_pendulum_deriv2 ( t, x )

[g,m1,m2,l1,l2] = double_pendulum_data ( );

xdot = zeros(4,1);

xdot(1)=x(2);

xdot(2)=-((g*(2*m1+m2)*sin(x(1))+m2*(g*sin(x(1)-2*x(3))+2*(l2*x(4)^2+...
    l1*x(2)^2*cos(x(1)-x(3)))*sin(x(1)-x(3))))/...
    (2*l1*(m1+m2-m2*cos(x(1)-x(3))^2)));

xdot(3)=x(4);

xdot(4)=(((m1+m2)*(l1*x(2)^2+g*cos(x(1)))+l2*m2*x(4)^2*cos(x(1)-x(3)))*...
    sin(x(1)-x(3)))/(l2*(m1+m2-m2*cos(x(1)-x(3))^2));

  return
end

