Code covered by the BSD License  

Highlights from
Double spherical pendulum

image thumbnail

Double spherical pendulum

by

 

02 Jul 2012 (Updated )

Numerical solution of double spherical pendulum Lagrange equations along with their analytical form

doublependulum3D(t,x,flag,l1,l2,m1,m2,g)
function F= doublependulum3D(t,x,flag,l1,l2,m1,m2,g)
%System of first order ODEs 8x8 for ph1,th1,ph2,th2 and their first derivatives

F = [x(2);
    (l1*m2*x(2)^2*sin(2*x(5)) - l1*m2*x(4)^2*sin(2*x(1)) - l1*m2*x(2)^2*sin(2*x(1)) + l1*m2*x(4)^2*sin(2*x(5)) + 2*g*m2*cos(x(1))*cos(x(3))^3*sin(x(1)) - 2*g*m2*cos(x(3))^3*cos(x(5))*sin(x(5)) + 2*l1*m1*x(2)*x(4)*sin(2*x(3)) - 2*g*m2*cos(x(1))*cos(x(3))*sin(x(1)) + 2*g*m2*cos(x(3))*cos(x(5))*sin(x(5)) + 4*g*m2*cos(x(1))*cos(x(3))*cos(x(5))^2*sin(x(1)) + 2*g*m2*cos(x(1))*cos(x(3))*cos(x(7))^2*sin(x(1)) - 4*g*m2*cos(x(1))^2*cos(x(3))*cos(x(5))*sin(x(5)) - 2*g*m2*cos(x(3))*cos(x(5))*cos(x(7))^2*sin(x(5)) + 4*l1*m2*x(2)^2*cos(x(1))*cos(x(3))^2*sin(x(1)) - 2*l1*m2*x(2)^2*cos(x(1))*cos(x(3))^4*sin(x(1)) + 4*l1*m2*x(2)^2*cos(x(1))*cos(x(5))^2*sin(x(1)) + 2*l1*m2*x(4)^2*cos(x(1))*cos(x(3))^2*sin(x(1)) + 2*l1*m2*x(2)^2*cos(x(1))*cos(x(7))^2*sin(x(1)) + 4*l1*m2*x(4)^2*cos(x(1))*cos(x(5))^2*sin(x(1)) - 4*l1*m2*x(2)^2*cos(x(1))^2*cos(x(5))*sin(x(5)) + 2*l1*m2*x(4)^2*cos(x(1))*cos(x(7))^2*sin(x(1)) - 4*l1*m2*x(2)^2*cos(x(3))^2*cos(x(5))*sin(x(5)) - 4*l1*m2*x(4)^2*cos(x(1))^2*cos(x(5))*sin(x(5)) + 2*l1*m2*x(2)^2*cos(x(3))^4*cos(x(5))*sin(x(5)) - 2*l1*m2*x(4)^2*cos(x(3))^2*cos(x(5))*sin(x(5)) - 2*l1*m2*x(2)^2*cos(x(5))*cos(x(7))^2*sin(x(5)) - 2*l1*m2*x(4)^2*cos(x(5))*cos(x(7))^2*sin(x(5)) + 4*l1*m2*x(2)*x(4)*cos(x(3))^3*sin(x(3)) - 4*g*m2*cos(x(1))*cos(x(3))^3*cos(x(5))^2*sin(x(1)) - 2*g*m2*cos(x(1))*cos(x(3))^3*cos(x(7))^2*sin(x(1)) + 4*g*m2*cos(x(1))^2*cos(x(3))^3*cos(x(5))*sin(x(5)) + 2*g*m2*cos(x(3))^3*cos(x(5))*cos(x(7))^2*sin(x(5)) + 4*l1*m2*x(2)*x(4)*cos(x(1))^2*cos(x(3))*sin(x(3)) + 4*l1*m2*x(2)*x(4)*cos(x(3))*cos(x(5))^2*sin(x(3)) + 4*l1*m2*x(2)*x(4)*cos(x(3))*cos(x(7))^2*sin(x(3)) - 4*g*m2*cos(x(1))*cos(x(3))*cos(x(5))^2*cos(x(7))^2*sin(x(1)) + 4*g*m2*cos(x(1))^2*cos(x(3))*cos(x(5))*cos(x(7))^2*sin(x(5)) - 8*l1*m2*x(2)^2*cos(x(1))*cos(x(3))^2*cos(x(5))^2*sin(x(1)) + 4*l1*m2*x(2)^2*cos(x(1))*cos(x(3))^4*cos(x(5))^2*sin(x(1)) - 4*l1*m2*x(2)^2*cos(x(1))*cos(x(3))^2*cos(x(7))^2*sin(x(1)) - 4*l1*m2*x(4)^2*cos(x(1))*cos(x(3))^2*cos(x(5))^2*sin(x(1)) + 2*l1*m2*x(2)^2*cos(x(1))*cos(x(3))^4*cos(x(7))^2*sin(x(1)) - 4*l1*m2*x(2)^2*cos(x(1))*cos(x(5))^2*cos(x(7))^2*sin(x(1)) + 8*l1*m2*x(2)^2*cos(x(1))^2*cos(x(3))^2*cos(x(5))*sin(x(5)) - 2*l1*m2*x(4)^2*cos(x(1))*cos(x(3))^2*cos(x(7))^2*sin(x(1)) - 4*l1*m2*x(2)^2*cos(x(1))^2*cos(x(3))^4*cos(x(5))*sin(x(5)) - 4*l1*m2*x(4)^2*cos(x(1))*cos(x(5))^2*cos(x(7))^2*sin(x(1)) + 4*l1*m2*x(4)^2*cos(x(1))^2*cos(x(3))^2*cos(x(5))*sin(x(5)) + 4*l1*m2*x(2)^2*cos(x(1))^2*cos(x(5))*cos(x(7))^2*sin(x(5)) + 4*l1*m2*x(2)^2*cos(x(3))^2*cos(x(5))*cos(x(7))^2*sin(x(5)) + 4*l1*m2*x(4)^2*cos(x(1))^2*cos(x(5))*cos(x(7))^2*sin(x(5)) - 2*l1*m2*x(2)^2*cos(x(3))^4*cos(x(5))*cos(x(7))^2*sin(x(5)) + 2*l1*m2*x(4)^2*cos(x(3))^2*cos(x(5))*cos(x(7))^2*sin(x(5)) - 4*l1*m2*x(2)*x(4)*cos(x(1))^2*cos(x(3))^3*sin(x(3)) - 4*l1*m2*x(2)*x(4)*cos(x(3))^3*cos(x(5))^2*sin(x(3)) - 8*l1*m2*x(2)*x(4)*cos(x(3))^3*cos(x(7))^2*sin(x(3)) + 4*g*m2*cos(x(1))*cos(x(3))^3*cos(x(5))^2*cos(x(7))^2*sin(x(1)) - 4*g*m2*cos(x(1))^2*cos(x(3))^3*cos(x(5))*cos(x(7))^2*sin(x(5)) - 2*l2*m2*x(6)^2*cos(x(1))*sin(x(3))*sin(x(5))*sin(x(7)) + 2*l2*m2*x(6)^2*cos(x(5))*sin(x(1))*sin(x(3))*sin(x(7)) - 2*l2*m2*x(8)^2*cos(x(1))*sin(x(3))*sin(x(5))*sin(x(7)) + 2*l2*m2*x(8)^2*cos(x(5))*sin(x(1))*sin(x(3))*sin(x(7)) - 8*l1*m2*x(2)*x(4)*cos(x(1))^2*cos(x(3))*cos(x(5))^2*sin(x(3)) - 4*l1*m2*x(2)*x(4)*cos(x(1))^2*cos(x(3))*cos(x(7))^2*sin(x(3)) - 4*l1*m2*x(2)*x(4)*cos(x(3))*cos(x(5))^2*cos(x(7))^2*sin(x(3)) + 8*l1*m2*x(2)^2*cos(x(1))*cos(x(3))^2*cos(x(5))^2*cos(x(7))^2*sin(x(1)) - 4*l1*m2*x(2)^2*cos(x(1))*cos(x(3))^4*cos(x(5))^2*cos(x(7))^2*sin(x(1)) + 4*l1*m2*x(4)^2*cos(x(1))*cos(x(3))^2*cos(x(5))^2*cos(x(7))^2*sin(x(1)) - 8*l1*m2*x(2)^2*cos(x(1))^2*cos(x(3))^2*cos(x(5))*cos(x(7))^2*sin(x(5)) + 4*l1*m2*x(2)^2*cos(x(1))^2*cos(x(3))^4*cos(x(5))*cos(x(7))^2*sin(x(5)) - 4*l1*m2*x(4)^2*cos(x(1))^2*cos(x(3))^2*cos(x(5))*cos(x(7))^2*sin(x(5)) + 8*l1*m2*x(2)*x(4)*cos(x(1))^2*cos(x(3))^3*cos(x(5))^2*sin(x(3)) + 4*l1*m2*x(2)*x(4)*cos(x(1))^2*cos(x(3))^3*cos(x(7))^2*sin(x(3)) + 4*l1*m2*x(2)*x(4)*cos(x(3))^3*cos(x(5))^2*cos(x(7))^2*sin(x(3)) - 2*g*m2*cos(x(1))*cos(x(3))^2*cos(x(7))*sin(x(3))*sin(x(5))*sin(x(7)) + 2*g*m2*cos(x(3))^2*cos(x(5))*cos(x(7))*sin(x(1))*sin(x(3))*sin(x(7)) + 2*l2*m2*x(6)^2*cos(x(1))*cos(x(7))^2*sin(x(3))*sin(x(5))*sin(x(7)) - 2*l2*m2*x(6)^2*cos(x(5))*cos(x(7))^2*sin(x(1))*sin(x(3))*sin(x(7)) - 8*l1*m2*x(2)*x(4)*cos(x(1))^2*cos(x(3))^3*cos(x(5))^2*cos(x(7))^2*sin(x(3)) - 8*l1*m2*x(2)*x(4)*cos(x(3))^2*cos(x(7))*sin(x(1))*sin(x(5))*sin(x(7)) + 8*l1*m2*x(2)*x(4)*cos(x(3))^4*cos(x(7))*sin(x(1))*sin(x(5))*sin(x(7)) - 2*l1*m2*x(2)^2*cos(x(1))*cos(x(3))*cos(x(7))*sin(x(3))*sin(x(5))*sin(x(7)) + 2*l1*m2*x(2)^2*cos(x(3))*cos(x(5))*cos(x(7))*sin(x(1))*sin(x(3))*sin(x(7)) - 2*l1*m2*x(4)^2*cos(x(1))*cos(x(3))*cos(x(7))*sin(x(3))*sin(x(5))*sin(x(7)) + 2*l1*m2*x(4)^2*cos(x(3))*cos(x(5))*cos(x(7))*sin(x(1))*sin(x(3))*sin(x(7)) + 8*l1*m2*x(2)*x(4)*cos(x(1))^2*cos(x(3))*cos(x(5))^2*cos(x(7))^2*sin(x(3)) + 2*l1*m2*x(2)^2*cos(x(1))*cos(x(3))^3*cos(x(7))*sin(x(3))*sin(x(5))*sin(x(7)) - 2*l1*m2*x(2)^2*cos(x(3))^3*cos(x(5))*cos(x(7))*sin(x(1))*sin(x(3))*sin(x(7)) - 8*l1*m2*x(2)*x(4)*cos(x(1))*cos(x(3))^2*cos(x(5))*cos(x(7))*sin(x(7)) + 8*l1*m2*x(2)*x(4)*cos(x(1))*cos(x(3))^4*cos(x(5))*cos(x(7))*sin(x(7)) - 8*l1*m2*x(2)*x(4)*cos(x(1))*cos(x(3))*cos(x(5))*sin(x(1))*sin(x(3))*sin(x(5)) + 8*l1*m2*x(2)*x(4)*cos(x(1))*cos(x(3))^3*cos(x(5))*sin(x(1))*sin(x(3))*sin(x(5)) - 8*l1*m2*x(2)*x(4)*cos(x(1))*cos(x(3))^3*cos(x(5))*cos(x(7))^2*sin(x(1))*sin(x(3))*sin(x(5)) + 8*l1*m2*x(2)*x(4)*cos(x(1))*cos(x(3))*cos(x(5))*cos(x(7))^2*sin(x(1))*sin(x(3))*sin(x(5)))/(2*l1*(cos(x(3))^2 - 1)*(- 2*m2*cos(x(1))^2*cos(x(3))^2*cos(x(5))^2*cos(x(7))^2 + 2*m2*cos(x(1))^2*cos(x(3))^2*cos(x(5))^2 + m2*cos(x(1))^2*cos(x(3))^2*cos(x(7))^2 - m2*cos(x(1))^2*cos(x(3))^2 + 2*m2*cos(x(1))^2*cos(x(5))^2*cos(x(7))^2 - 2*m2*cos(x(1))^2*cos(x(5))^2 - m2*cos(x(1))^2*cos(x(7))^2 + m2*cos(x(1))^2 - 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(3))^2*cos(x(5))*cos(x(7))^2 + 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(3))^2*cos(x(5)) - 2*m2*sin(x(3))*sin(x(7))*cos(x(1))*cos(x(3))*cos(x(5))*cos(x(7)) + 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(5))*cos(x(7))^2 - 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(5)) + m2*cos(x(3))^2*cos(x(5))^2*cos(x(7))^2 - m2*cos(x(3))^2*cos(x(5))^2 - 2*m2*cos(x(3))^2*cos(x(7))^2 + m2*cos(x(3))^2 - 2*m2*sin(x(1))*sin(x(3))*sin(x(5))*sin(x(7))*cos(x(3))*cos(x(7)) - m2*cos(x(5))^2*cos(x(7))^2 + m2*cos(x(5))^2 + m2*cos(x(7))^2 + m1));
    x(4);
    (l2*m2*x(6)^2*cos(x(7))^3*sin(x(3)) - g*m2*cos(x(1))^2*sin(x(3)) - g*m2*cos(x(5))^2*sin(x(3)) - g*m2*cos(x(7))^2*sin(x(3)) - g*m1*sin(x(3)) + 2*g*m2*cos(x(1))^2*cos(x(5))^2*sin(x(3)) + g*m2*cos(x(1))^2*cos(x(7))^2*sin(x(3)) + g*m2*cos(x(5))^2*cos(x(7))^2*sin(x(3)) + l1*m1*x(2)^2*cos(x(3))*sin(x(3)) + l1*m2*x(2)^2*cos(x(3))*sin(x(3)) + l1*m2*x(4)^2*cos(x(3))*sin(x(3)) - l2*m2*x(6)^2*cos(x(7))*sin(x(3)) - l2*m2*x(8)^2*cos(x(7))*sin(x(3)) - l1*m2*x(4)^2*cos(x(1))^2*cos(x(3))*sin(x(3)) - l1*m2*x(2)^2*cos(x(3))*cos(x(7))^2*sin(x(3)) - l1*m2*x(4)^2*cos(x(3))*cos(x(5))^2*sin(x(3)) - 2*l1*m2*x(4)^2*cos(x(3))*cos(x(7))^2*sin(x(3)) - 2*g*m2*cos(x(1))^2*cos(x(5))^2*cos(x(7))^2*sin(x(3)) + 2*l1*m2*x(4)^2*cos(x(1))^2*cos(x(3))*cos(x(5))^2*sin(x(3)) + l1*m2*x(4)^2*cos(x(1))^2*cos(x(3))*cos(x(7))^2*sin(x(3)) + l1*m2*x(4)^2*cos(x(3))*cos(x(5))^2*cos(x(7))^2*sin(x(3)) + g*m2*cos(x(1))*cos(x(3))*cos(x(5))*cos(x(7))*sin(x(7)) - l1*m2*x(2)^2*cos(x(1))*cos(x(5))*cos(x(7))*sin(x(7)) + l2*m2*x(6)^2*cos(x(1))*cos(x(3))*cos(x(5))*sin(x(7)) - l1*m2*x(4)^2*cos(x(1))*cos(x(5))*cos(x(7))*sin(x(7)) + l2*m2*x(8)^2*cos(x(1))*cos(x(3))*cos(x(5))*sin(x(7)) + 2*g*m2*cos(x(1))*cos(x(5))*sin(x(1))*sin(x(3))*sin(x(5)) + g*m2*cos(x(3))*cos(x(7))*sin(x(1))*sin(x(5))*sin(x(7)) - l1*m2*x(2)^2*cos(x(7))*sin(x(1))*sin(x(5))*sin(x(7)) + l2*m2*x(6)^2*cos(x(3))*sin(x(1))*sin(x(5))*sin(x(7)) - l1*m2*x(4)^2*cos(x(7))*sin(x(1))*sin(x(5))*sin(x(7)) + l2*m2*x(8)^2*cos(x(3))*sin(x(1))*sin(x(5))*sin(x(7)) - 2*l1*m2*x(4)^2*cos(x(1))^2*cos(x(3))*cos(x(5))^2*cos(x(7))^2*sin(x(3)) + l1*m2*x(2)^2*cos(x(1))*cos(x(3))^2*cos(x(5))*cos(x(7))*sin(x(7)) + 2*l1*m2*x(4)^2*cos(x(1))*cos(x(3))^2*cos(x(5))*cos(x(7))*sin(x(7)) - l2*m2*x(6)^2*cos(x(1))*cos(x(3))*cos(x(5))*cos(x(7))^2*sin(x(7)) - 2*g*m2*cos(x(1))*cos(x(5))*cos(x(7))^2*sin(x(1))*sin(x(3))*sin(x(5)) + l1*m2*x(2)^2*cos(x(3))^2*cos(x(7))*sin(x(1))*sin(x(5))*sin(x(7)) + 2*l1*m2*x(4)^2*cos(x(3))^2*cos(x(7))*sin(x(1))*sin(x(5))*sin(x(7)) - l2*m2*x(6)^2*cos(x(3))*cos(x(7))^2*sin(x(1))*sin(x(5))*sin(x(7)) + 2*l1*m2*x(4)^2*cos(x(1))*cos(x(3))*cos(x(5))*sin(x(1))*sin(x(3))*sin(x(5)) - 2*l1*m2*x(4)^2*cos(x(1))*cos(x(3))*cos(x(5))*cos(x(7))^2*sin(x(1))*sin(x(3))*sin(x(5)))/(l1*(- 2*m2*cos(x(1))^2*cos(x(3))^2*cos(x(5))^2*cos(x(7))^2 + 2*m2*cos(x(1))^2*cos(x(3))^2*cos(x(5))^2 + m2*cos(x(1))^2*cos(x(3))^2*cos(x(7))^2 - m2*cos(x(1))^2*cos(x(3))^2 + 2*m2*cos(x(1))^2*cos(x(5))^2*cos(x(7))^2 - 2*m2*cos(x(1))^2*cos(x(5))^2 - m2*cos(x(1))^2*cos(x(7))^2 + m2*cos(x(1))^2 - 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(3))^2*cos(x(5))*cos(x(7))^2 + 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(3))^2*cos(x(5)) - 2*m2*sin(x(3))*sin(x(7))*cos(x(1))*cos(x(3))*cos(x(5))*cos(x(7)) + 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(5))*cos(x(7))^2 - 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(5)) + m2*cos(x(3))^2*cos(x(5))^2*cos(x(7))^2 - m2*cos(x(3))^2*cos(x(5))^2 - 2*m2*cos(x(3))^2*cos(x(7))^2 + m2*cos(x(3))^2 - 2*m2*sin(x(1))*sin(x(3))*sin(x(5))*sin(x(7))*cos(x(3))*cos(x(7)) - m2*cos(x(5))^2*cos(x(7))^2 + m2*cos(x(5))^2 + m2*cos(x(7))^2 + m1));
    x(6);
    (l2*m2*x(6)^2*sin(2*x(1)) + l2*m2*x(8)^2*sin(2*x(1)) - l2*m2*x(6)^2*sin(2*x(5)) - l2*m2*x(8)^2*sin(2*x(5)) + 2*l2*m1*x(6)*x(8)*sin(2*x(7)) - 2*l2*m2*x(6)^2*cos(x(1))*cos(x(3))^2*sin(x(1)) - 4*l2*m2*x(6)^2*cos(x(1))*cos(x(5))^2*sin(x(1)) - 2*l2*m2*x(8)^2*cos(x(1))*cos(x(3))^2*sin(x(1)) - 4*l2*m2*x(6)^2*cos(x(1))*cos(x(7))^2*sin(x(1)) - 4*l2*m2*x(8)^2*cos(x(1))*cos(x(5))^2*sin(x(1)) + 2*l2*m2*x(6)^2*cos(x(1))*cos(x(7))^4*sin(x(1)) + 4*l2*m2*x(6)^2*cos(x(1))^2*cos(x(5))*sin(x(5)) - 2*l2*m2*x(8)^2*cos(x(1))*cos(x(7))^2*sin(x(1)) + 2*l2*m2*x(6)^2*cos(x(3))^2*cos(x(5))*sin(x(5)) + 4*l2*m2*x(8)^2*cos(x(1))^2*cos(x(5))*sin(x(5)) + 2*l2*m2*x(8)^2*cos(x(3))^2*cos(x(5))*sin(x(5)) + 4*l2*m2*x(6)^2*cos(x(5))*cos(x(7))^2*sin(x(5)) - 2*l2*m2*x(6)^2*cos(x(5))*cos(x(7))^4*sin(x(5)) + 2*l2*m2*x(8)^2*cos(x(5))*cos(x(7))^2*sin(x(5)) + 4*l2*m2*x(6)*x(8)*cos(x(7))^3*sin(x(7)) + 4*l2*m2*x(6)*x(8)*cos(x(1))^2*cos(x(7))*sin(x(7)) + 4*l2*m2*x(6)*x(8)*cos(x(3))^2*cos(x(7))*sin(x(7)) + 4*l2*m2*x(6)*x(8)*cos(x(5))^2*cos(x(7))*sin(x(7)) + 4*l2*m2*x(6)^2*cos(x(1))*cos(x(3))^2*cos(x(5))^2*sin(x(1)) + 4*l2*m2*x(6)^2*cos(x(1))*cos(x(3))^2*cos(x(7))^2*sin(x(1)) + 4*l2*m2*x(8)^2*cos(x(1))*cos(x(3))^2*cos(x(5))^2*sin(x(1)) - 2*l2*m2*x(6)^2*cos(x(1))*cos(x(3))^2*cos(x(7))^4*sin(x(1)) + 8*l2*m2*x(6)^2*cos(x(1))*cos(x(5))^2*cos(x(7))^2*sin(x(1)) - 4*l2*m2*x(6)^2*cos(x(1))^2*cos(x(3))^2*cos(x(5))*sin(x(5)) + 2*l2*m2*x(8)^2*cos(x(1))*cos(x(3))^2*cos(x(7))^2*sin(x(1)) - 4*l2*m2*x(6)^2*cos(x(1))*cos(x(5))^2*cos(x(7))^4*sin(x(1)) + 4*l2*m2*x(8)^2*cos(x(1))*cos(x(5))^2*cos(x(7))^2*sin(x(1)) - 4*l2*m2*x(8)^2*cos(x(1))^2*cos(x(3))^2*cos(x(5))*sin(x(5)) - 8*l2*m2*x(6)^2*cos(x(1))^2*cos(x(5))*cos(x(7))^2*sin(x(5)) + 4*l2*m2*x(6)^2*cos(x(1))^2*cos(x(5))*cos(x(7))^4*sin(x(5)) - 4*l2*m2*x(6)^2*cos(x(3))^2*cos(x(5))*cos(x(7))^2*sin(x(5)) - 4*l2*m2*x(8)^2*cos(x(1))^2*cos(x(5))*cos(x(7))^2*sin(x(5)) + 2*l2*m2*x(6)^2*cos(x(3))^2*cos(x(5))*cos(x(7))^4*sin(x(5)) - 2*l2*m2*x(8)^2*cos(x(3))^2*cos(x(5))*cos(x(7))^2*sin(x(5)) - 4*l2*m2*x(6)*x(8)*cos(x(1))^2*cos(x(7))^3*sin(x(7)) - 8*l2*m2*x(6)*x(8)*cos(x(3))^2*cos(x(7))^3*sin(x(7)) - 4*l2*m2*x(6)*x(8)*cos(x(5))^2*cos(x(7))^3*sin(x(7)) + 2*g*m1*cos(x(1))*cos(x(3))*sin(x(3))*sin(x(5))*sin(x(7)) - 2*g*m1*cos(x(3))*cos(x(5))*sin(x(1))*sin(x(3))*sin(x(7)) + 2*g*m2*cos(x(1))*cos(x(3))*sin(x(3))*sin(x(5))*sin(x(7)) - 2*g*m2*cos(x(3))*cos(x(5))*sin(x(1))*sin(x(3))*sin(x(7)) + 2*l1*m1*x(2)^2*cos(x(1))*sin(x(3))*sin(x(5))*sin(x(7)) - 2*l1*m1*x(2)^2*cos(x(5))*sin(x(1))*sin(x(3))*sin(x(7)) + 2*l1*m2*x(2)^2*cos(x(1))*sin(x(3))*sin(x(5))*sin(x(7)) - 2*l1*m2*x(2)^2*cos(x(5))*sin(x(1))*sin(x(3))*sin(x(7)) + 2*l1*m1*x(4)^2*cos(x(1))*sin(x(3))*sin(x(5))*sin(x(7)) - 2*l1*m1*x(4)^2*cos(x(5))*sin(x(1))*sin(x(3))*sin(x(7)) + 2*l1*m2*x(4)^2*cos(x(1))*sin(x(3))*sin(x(5))*sin(x(7)) - 2*l1*m2*x(4)^2*cos(x(5))*sin(x(1))*sin(x(3))*sin(x(7)) - 4*l2*m2*x(6)*x(8)*cos(x(1))^2*cos(x(3))^2*cos(x(7))*sin(x(7)) - 8*l2*m2*x(6)*x(8)*cos(x(1))^2*cos(x(5))^2*cos(x(7))*sin(x(7)) - 4*l2*m2*x(6)*x(8)*cos(x(3))^2*cos(x(5))^2*cos(x(7))*sin(x(7)) - 8*l2*m2*x(6)^2*cos(x(1))*cos(x(3))^2*cos(x(5))^2*cos(x(7))^2*sin(x(1)) + 4*l2*m2*x(6)^2*cos(x(1))*cos(x(3))^2*cos(x(5))^2*cos(x(7))^4*sin(x(1)) - 4*l2*m2*x(8)^2*cos(x(1))*cos(x(3))^2*cos(x(5))^2*cos(x(7))^2*sin(x(1)) + 8*l2*m2*x(6)^2*cos(x(1))^2*cos(x(3))^2*cos(x(5))*cos(x(7))^2*sin(x(5)) - 4*l2*m2*x(6)^2*cos(x(1))^2*cos(x(3))^2*cos(x(5))*cos(x(7))^4*sin(x(5)) + 4*l2*m2*x(8)^2*cos(x(1))^2*cos(x(3))^2*cos(x(5))*cos(x(7))^2*sin(x(5)) + 4*l2*m2*x(6)*x(8)*cos(x(1))^2*cos(x(3))^2*cos(x(7))^3*sin(x(7)) + 8*l2*m2*x(6)*x(8)*cos(x(1))^2*cos(x(5))^2*cos(x(7))^3*sin(x(7)) + 4*l2*m2*x(6)*x(8)*cos(x(3))^2*cos(x(5))^2*cos(x(7))^3*sin(x(7)) - 2*l1*m1*x(2)^2*cos(x(1))*cos(x(3))^2*sin(x(3))*sin(x(5))*sin(x(7)) + 2*l1*m1*x(2)^2*cos(x(3))^2*cos(x(5))*sin(x(1))*sin(x(3))*sin(x(7)) - 2*l1*m2*x(2)^2*cos(x(1))*cos(x(3))^2*sin(x(3))*sin(x(5))*sin(x(7)) + 2*l1*m2*x(2)^2*cos(x(3))^2*cos(x(5))*sin(x(1))*sin(x(3))*sin(x(7)) - 8*l2*m2*x(6)*x(8)*cos(x(1))^2*cos(x(3))^2*cos(x(5))^2*cos(x(7))^3*sin(x(7)) - 8*l2*m2*x(6)*x(8)*cos(x(3))*cos(x(7))^2*sin(x(1))*sin(x(3))*sin(x(5)) + 8*l2*m2*x(6)*x(8)*cos(x(3))*cos(x(7))^4*sin(x(1))*sin(x(3))*sin(x(5)) + 2*l2*m2*x(6)^2*cos(x(1))*cos(x(3))*cos(x(7))*sin(x(3))*sin(x(5))*sin(x(7)) - 2*l2*m2*x(6)^2*cos(x(3))*cos(x(5))*cos(x(7))*sin(x(1))*sin(x(3))*sin(x(7)) + 2*l2*m2*x(8)^2*cos(x(1))*cos(x(3))*cos(x(7))*sin(x(3))*sin(x(5))*sin(x(7)) - 2*l2*m2*x(8)^2*cos(x(3))*cos(x(5))*cos(x(7))*sin(x(1))*sin(x(3))*sin(x(7)) + 8*l2*m2*x(6)*x(8)*cos(x(1))^2*cos(x(3))^2*cos(x(5))^2*cos(x(7))*sin(x(7)) - 2*l2*m2*x(6)^2*cos(x(1))*cos(x(3))*cos(x(7))^3*sin(x(3))*sin(x(5))*sin(x(7)) + 2*l2*m2*x(6)^2*cos(x(3))*cos(x(5))*cos(x(7))^3*sin(x(1))*sin(x(3))*sin(x(7)) - 8*l2*m2*x(6)*x(8)*cos(x(1))*cos(x(3))*cos(x(5))*cos(x(7))^2*sin(x(3)) + 8*l2*m2*x(6)*x(8)*cos(x(1))*cos(x(3))*cos(x(5))*cos(x(7))^4*sin(x(3)) - 8*l2*m2*x(6)*x(8)*cos(x(1))*cos(x(5))*cos(x(7))*sin(x(1))*sin(x(5))*sin(x(7)) + 8*l2*m2*x(6)*x(8)*cos(x(1))*cos(x(5))*cos(x(7))^3*sin(x(1))*sin(x(5))*sin(x(7)) - 8*l2*m2*x(6)*x(8)*cos(x(1))*cos(x(3))^2*cos(x(5))*cos(x(7))^3*sin(x(1))*sin(x(5))*sin(x(7)) + 8*l2*m2*x(6)*x(8)*cos(x(1))*cos(x(3))^2*cos(x(5))*cos(x(7))*sin(x(1))*sin(x(5))*sin(x(7)))/(2*l2*(cos(x(7))^2 - 1)*(- 2*m2*cos(x(1))^2*cos(x(3))^2*cos(x(5))^2*cos(x(7))^2 + 2*m2*cos(x(1))^2*cos(x(3))^2*cos(x(5))^2 + m2*cos(x(1))^2*cos(x(3))^2*cos(x(7))^2 - m2*cos(x(1))^2*cos(x(3))^2 + 2*m2*cos(x(1))^2*cos(x(5))^2*cos(x(7))^2 - 2*m2*cos(x(1))^2*cos(x(5))^2 - m2*cos(x(1))^2*cos(x(7))^2 + m2*cos(x(1))^2 - 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(3))^2*cos(x(5))*cos(x(7))^2 + 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(3))^2*cos(x(5)) - 2*m2*sin(x(3))*sin(x(7))*cos(x(1))*cos(x(3))*cos(x(5))*cos(x(7)) + 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(5))*cos(x(7))^2 - 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(5)) + m2*cos(x(3))^2*cos(x(5))^2*cos(x(7))^2 - m2*cos(x(3))^2*cos(x(5))^2 - 2*m2*cos(x(3))^2*cos(x(7))^2 + m2*cos(x(3))^2 - 2*m2*sin(x(1))*sin(x(3))*sin(x(5))*sin(x(7))*cos(x(3))*cos(x(7)) - m2*cos(x(5))^2*cos(x(7))^2 + m2*cos(x(5))^2 + m2*cos(x(7))^2 + m1));
    x(8);
    ((l2*m1*x(6)^2*sin(2*x(7)))/2 - g*m2*cos(x(3))^2*sin(x(7)) - g*m1*cos(x(3))^2*sin(x(7)) + (l2*m2*x(6)^2*sin(2*x(7)))/2 + (l2*m2*x(8)^2*sin(2*x(7)))/2 + l1*m1*x(2)^2*cos(x(3))^3*sin(x(7)) + l1*m2*x(2)^2*cos(x(3))^3*sin(x(7)) - l1*m1*x(2)^2*cos(x(3))*sin(x(7)) - l1*m2*x(2)^2*cos(x(3))*sin(x(7)) - l1*m1*x(4)^2*cos(x(3))*sin(x(7)) - l1*m2*x(4)^2*cos(x(3))*sin(x(7)) - l2*m2*x(6)^2*cos(x(3))^2*cos(x(7))*sin(x(7)) - l2*m2*x(8)^2*cos(x(1))^2*cos(x(7))*sin(x(7)) - 2*l2*m2*x(8)^2*cos(x(3))^2*cos(x(7))*sin(x(7)) - l2*m2*x(8)^2*cos(x(5))^2*cos(x(7))*sin(x(7)) + l2*m2*x(8)^2*cos(x(1))^2*cos(x(3))^2*cos(x(7))*sin(x(7)) + 2*l2*m2*x(8)^2*cos(x(1))^2*cos(x(5))^2*cos(x(7))*sin(x(7)) + l2*m2*x(8)^2*cos(x(3))^2*cos(x(5))^2*cos(x(7))*sin(x(7)) + g*m1*cos(x(1))*cos(x(3))*cos(x(5))*cos(x(7))*sin(x(3)) + g*m2*cos(x(1))*cos(x(3))*cos(x(5))*cos(x(7))*sin(x(3)) + l1*m1*x(2)^2*cos(x(1))*cos(x(5))*cos(x(7))*sin(x(3)) + l1*m2*x(2)^2*cos(x(1))*cos(x(5))*cos(x(7))*sin(x(3)) + l1*m1*x(4)^2*cos(x(1))*cos(x(5))*cos(x(7))*sin(x(3)) - l2*m2*x(6)^2*cos(x(1))*cos(x(3))*cos(x(5))*sin(x(3)) + l1*m2*x(4)^2*cos(x(1))*cos(x(5))*cos(x(7))*sin(x(3)) - l2*m2*x(8)^2*cos(x(1))*cos(x(3))*cos(x(5))*sin(x(3)) + g*m1*cos(x(3))*cos(x(7))*sin(x(1))*sin(x(3))*sin(x(5)) + g*m2*cos(x(3))*cos(x(7))*sin(x(1))*sin(x(3))*sin(x(5)) + l1*m1*x(2)^2*cos(x(7))*sin(x(1))*sin(x(3))*sin(x(5)) + l1*m2*x(2)^2*cos(x(7))*sin(x(1))*sin(x(3))*sin(x(5)) + l1*m1*x(4)^2*cos(x(7))*sin(x(1))*sin(x(3))*sin(x(5)) - l2*m2*x(6)^2*cos(x(3))*sin(x(1))*sin(x(3))*sin(x(5)) + l1*m2*x(4)^2*cos(x(7))*sin(x(1))*sin(x(3))*sin(x(5)) - l2*m2*x(8)^2*cos(x(3))*sin(x(1))*sin(x(3))*sin(x(5)) - 2*l2*m2*x(8)^2*cos(x(1))^2*cos(x(3))^2*cos(x(5))^2*cos(x(7))*sin(x(7)) - l1*m1*x(2)^2*cos(x(1))*cos(x(3))^2*cos(x(5))*cos(x(7))*sin(x(3)) - l1*m2*x(2)^2*cos(x(1))*cos(x(3))^2*cos(x(5))*cos(x(7))*sin(x(3)) + l2*m2*x(6)^2*cos(x(1))*cos(x(3))*cos(x(5))*cos(x(7))^2*sin(x(3)) + 2*l2*m2*x(8)^2*cos(x(1))*cos(x(3))*cos(x(5))*cos(x(7))^2*sin(x(3)) - l1*m1*x(2)^2*cos(x(3))^2*cos(x(7))*sin(x(1))*sin(x(3))*sin(x(5)) - l1*m2*x(2)^2*cos(x(3))^2*cos(x(7))*sin(x(1))*sin(x(3))*sin(x(5)) + l2*m2*x(6)^2*cos(x(3))*cos(x(7))^2*sin(x(1))*sin(x(3))*sin(x(5)) + 2*l2*m2*x(8)^2*cos(x(3))*cos(x(7))^2*sin(x(1))*sin(x(3))*sin(x(5)) + 2*l2*m2*x(8)^2*cos(x(1))*cos(x(5))*cos(x(7))*sin(x(1))*sin(x(5))*sin(x(7)) - 2*l2*m2*x(8)^2*cos(x(1))*cos(x(3))^2*cos(x(5))*cos(x(7))*sin(x(1))*sin(x(5))*sin(x(7)))/(l2*(- 2*m2*cos(x(1))^2*cos(x(3))^2*cos(x(5))^2*cos(x(7))^2 + 2*m2*cos(x(1))^2*cos(x(3))^2*cos(x(5))^2 + m2*cos(x(1))^2*cos(x(3))^2*cos(x(7))^2 - m2*cos(x(1))^2*cos(x(3))^2 + 2*m2*cos(x(1))^2*cos(x(5))^2*cos(x(7))^2 - 2*m2*cos(x(1))^2*cos(x(5))^2 - m2*cos(x(1))^2*cos(x(7))^2 + m2*cos(x(1))^2 - 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(3))^2*cos(x(5))*cos(x(7))^2 + 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(3))^2*cos(x(5)) - 2*m2*sin(x(3))*sin(x(7))*cos(x(1))*cos(x(3))*cos(x(5))*cos(x(7)) + 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(5))*cos(x(7))^2 - 2*m2*sin(x(1))*sin(x(5))*cos(x(1))*cos(x(5)) + m2*cos(x(3))^2*cos(x(5))^2*cos(x(7))^2 - m2*cos(x(3))^2*cos(x(5))^2 - 2*m2*cos(x(3))^2*cos(x(7))^2 + m2*cos(x(3))^2 - 2*m2*sin(x(1))*sin(x(3))*sin(x(5))*sin(x(7))*cos(x(3))*cos(x(7)) - m2*cos(x(5))^2*cos(x(7))^2 + m2*cos(x(5))^2 + m2*cos(x(7))^2 + m1))];
    

Contact us