import numpy as np
from math import sin,cos,sqrt

def updateJac(joints):
    theta1, theta2, theta3, theta4, theta5, theta6, theta7 = joints
    h =([0.077*cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 0.065*cos(theta1)*sin(theta3) - 0.459*sin(theta1)*sin(theta2) + 0.1059*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 0.1059*cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) + 0.077*sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 0.005*sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + 0.0528*cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 0.4574*sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + 0.005*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)) - 0.4574*cos(theta4)*sin(theta1)*sin(theta2) - 0.0528*sin(theta1)*sin(theta2)*sin(theta4) - 0.065*cos(theta2)*cos(theta3)*sin(theta1),
    0.459*cos(theta1)*cos(theta2) + 0.077*cos(theta6)*(cos(theta5)*(cos(theta1)*cos(theta2)*sin(theta4) + cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*cos(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) + 0.1059*sin(theta6)*(cos(theta5)*(cos(theta1)*cos(theta2)*sin(theta4) + cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*cos(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - 0.005*sin(theta5)*(cos(theta1)*cos(theta2)*sin(theta4) + cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2)) + 0.1059*cos(theta6)*(cos(theta1)*cos(theta2)*cos(theta4) - 1.0*cos(theta1)*cos(theta3)*sin(theta2)*sin(theta4)) - 0.077*sin(theta6)*(cos(theta1)*cos(theta2)*cos(theta4) - 1.0*cos(theta1)*cos(theta3)*sin(theta2)*sin(theta4)) + 0.4574*cos(theta1)*cos(theta2)*cos(theta4) - 0.065*cos(theta1)*cos(theta3)*sin(theta2) + 0.0528*cos(theta1)*cos(theta2)*sin(theta4) + 0.0528*cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2) - 0.4574*cos(theta1)*cos(theta3)*sin(theta2)*sin(theta4) - 0.005*cos(theta1)*cos(theta5)*sin(theta2)*sin(theta3),
    0.0528*cos(theta4)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)) - 0.077*cos(theta6)*(sin(theta5)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 0.1059*sin(theta6)*(sin(theta5)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 0.065*cos(theta3)*sin(theta1) - 0.4574*sin(theta4)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)) - 0.005*cos(theta5)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 0.005*cos(theta4)*sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)) - 0.1059*cos(theta6)*sin(theta4)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)) + 0.077*sin(theta4)*sin(theta6)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)) - 0.065*cos(theta1)*cos(theta2)*sin(theta3),
    0.077*sin(theta6)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 0.1059*cos(theta6)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + 0.005*sin(theta5)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 0.4574*cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 0.0528*sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 0.4574*cos(theta1)*sin(theta2)*sin(theta4) - 0.077*cos(theta5)*cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 0.1059*cos(theta5)*sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + 0.0528*cos(theta1)*cos(theta4)*sin(theta2),
    - 0.077*cos(theta6)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 0.1059*sin(theta6)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 0.005*cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 0.005*sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)),
    0.077*cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + 0.1059*sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + 0.1059*cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 0.077*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))),
    0,
    0.065*sin(theta1)*sin(theta3) - 0.459*cos(theta1)*sin(theta2) + 0.005*sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 0.005*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)) + 0.1059*cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 0.077*sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 0.077*cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 0.0528*cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 0.1059*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + 0.4574*sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 0.0528*cos(theta1)*sin(theta2)*sin(theta4) - 0.065*cos(theta1)*cos(theta2)*cos(theta3) - 0.4574*cos(theta1)*cos(theta4)*sin(theta2),
    0.005*sin(theta5)*(cos(theta2)*sin(theta1)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2)) - 0.077*cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta1)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - 0.1059*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta1)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - 0.459*cos(theta2)*sin(theta1) - 0.1059*cos(theta6)*(cos(theta2)*cos(theta4)*sin(theta1) - 1.0*cos(theta3)*sin(theta1)*sin(theta2)*sin(theta4)) + 0.077*sin(theta6)*(cos(theta2)*cos(theta4)*sin(theta1) - 1.0*cos(theta3)*sin(theta1)*sin(theta2)*sin(theta4)) + 0.065*cos(theta3)*sin(theta1)*sin(theta2) - 0.0528*cos(theta2)*sin(theta1)*sin(theta4) - 0.4574*cos(theta2)*cos(theta4)*sin(theta1) - 0.0528*cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2) + 0.4574*cos(theta3)*sin(theta1)*sin(theta2)*sin(theta4) + 0.005*cos(theta5)*sin(theta1)*sin(theta2)*sin(theta3),
    0.0528*cos(theta4)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)) - 0.077*cos(theta6)*(sin(theta5)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 0.1059*sin(theta6)*(sin(theta5)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 0.005*cos(theta5)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 0.065*cos(theta1)*cos(theta3) - 0.4574*sin(theta4)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)) + 0.065*cos(theta2)*sin(theta1)*sin(theta3) - 0.005*cos(theta4)*sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)) - 0.1059*cos(theta6)*sin(theta4)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)) + 0.077*sin(theta4)*sin(theta6)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)),
    0.005*sin(theta5)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 0.1059*cos(theta6)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + 0.077*sin(theta6)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 0.4574*cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 0.0528*sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 0.0528*cos(theta4)*sin(theta1)*sin(theta2) + 0.4574*sin(theta1)*sin(theta2)*sin(theta4) - 0.077*cos(theta5)*cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 0.1059*cos(theta5)*sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)),
    - 0.077*cos(theta6)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 0.1059*sin(theta6)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 0.005*cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 0.005*sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)),
    0.1059*cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 0.077*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + 0.077*cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) + 0.1059*sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)),
    0,
    0,
    0.077*sin(theta6)*(cos(theta4)*sin(theta2) + cos(theta2)*cos(theta3)*sin(theta4)) - 0.065*cos(theta2)*cos(theta3) - 0.4574*cos(theta4)*sin(theta2) - 0.0528*sin(theta2)*sin(theta4) - 0.077*cos(theta6)*(cos(theta5)*(sin(theta2)*sin(theta4) - 1.0*cos(theta2)*cos(theta3)*cos(theta4)) + cos(theta2)*sin(theta3)*sin(theta5)) - 0.1059*sin(theta6)*(cos(theta5)*(sin(theta2)*sin(theta4) - 1.0*cos(theta2)*cos(theta3)*cos(theta4)) + cos(theta2)*sin(theta3)*sin(theta5)) - 0.1059*cos(theta6)*(cos(theta4)*sin(theta2) + cos(theta2)*cos(theta3)*sin(theta4)) - 0.459*sin(theta2) + 0.005*sin(theta5)*(sin(theta2)*sin(theta4) - 1.0*cos(theta2)*cos(theta3)*cos(theta4)) + 0.0528*cos(theta2)*cos(theta3)*cos(theta4) - 0.4574*cos(theta2)*cos(theta3)*sin(theta4) - 0.005*cos(theta2)*cos(theta5)*sin(theta3),
    0.065*sin(theta2)*sin(theta3) - 0.077*cos(theta6)*(cos(theta3)*sin(theta2)*sin(theta5) + cos(theta4)*cos(theta5)*sin(theta2)*sin(theta3)) - 0.1059*sin(theta6)*(cos(theta3)*sin(theta2)*sin(theta5) + cos(theta4)*cos(theta5)*sin(theta2)*sin(theta3)) - 0.0528*cos(theta4)*sin(theta2)*sin(theta3) + 0.4574*sin(theta2)*sin(theta3)*sin(theta4) - 0.005*cos(theta3)*cos(theta5)*sin(theta2) + 0.005*cos(theta4)*sin(theta2)*sin(theta3)*sin(theta5) + 0.1059*cos(theta6)*sin(theta2)*sin(theta3)*sin(theta4) - 0.077*sin(theta2)*sin(theta3)*sin(theta4)*sin(theta6),
    0.0528*cos(theta2)*cos(theta4) - 0.4574*cos(theta2)*sin(theta4) - 0.1059*cos(theta6)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + 0.077*sin(theta6)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 0.005*sin(theta5)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) - 0.0528*cos(theta3)*sin(theta2)*sin(theta4) + 0.077*cos(theta5)*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 0.1059*cos(theta5)*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) - 0.4574*cos(theta3)*cos(theta4)*sin(theta2),
    0.005*sin(theta2)*sin(theta3)*sin(theta5) - 0.1059*sin(theta6)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 0.005*cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 0.077*cos(theta6)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)),
    0.1059*cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 0.077*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 0.077*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) - 0.1059*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)),
    0,
    (0.25*(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)))))/(cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    (0.25*(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta1)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4)*sin(theta1) - 1.0*cos(theta3)*sin(theta1)*sin(theta2)*sin(theta4))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta1)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2)) + cos(theta5)*sin(theta1)*sin(theta2)*sin(theta3)) + sin(theta6)*(cos(theta5)*(sin(theta2)*sin(theta4) - 1.0*cos(theta2)*cos(theta3)*cos(theta4)) + cos(theta2)*sin(theta3)*sin(theta5)) + 1.0*cos(theta7)*(1.0*cos(theta6)*(cos(theta5)*(cos(theta1)*cos(theta2)*sin(theta4) + cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*cos(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - sin(theta6)*(cos(theta1)*cos(theta2)*cos(theta4) - 1.0*cos(theta1)*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(cos(theta4)*sin(theta2) + cos(theta2)*cos(theta3)*sin(theta4)) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta1)*cos(theta2)*sin(theta4) + cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta1)*cos(theta5)*sin(theta2)*sin(theta3))))/(cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    -(0.25*(cos(theta7)*(cos(theta5)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(sin(theta5)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta4)*sin(theta6)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta7)*(cos(theta5)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta4)*sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta3)*sin(theta2)*sin(theta5) + cos(theta4)*cos(theta5)*sin(theta2)*sin(theta3)) + cos(theta7)*(cos(theta6)*(sin(theta5)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta4)*sin(theta6)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta6)*sin(theta2)*sin(theta3)*sin(theta4)))/(cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    (0.25*(cos(theta7)*(sin(theta6)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2))) + cos(theta6)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta7)*(sin(theta6)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + cos(theta7)*sin(theta5)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) + sin(theta5)*sin(theta7)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*cos(theta5)*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))/(cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    -(0.25*(cos(theta7)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta6)*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta6)*cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))))/(cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    (0.25*(sin(theta7)*(1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + 1.0*cos(theta7)*(cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))/(cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    -(0.25*(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)))))/(cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    dirac(cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) + (0.25*np.sign(cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)))))/(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    (0.25*np.sign(cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta1)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4)*sin(theta1) - 1.0*cos(theta3)*sin(theta1)*sin(theta2)*sin(theta4))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta1)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2)) + cos(theta5)*sin(theta1)*sin(theta2)*sin(theta3)) + sin(theta6)*(cos(theta5)*(sin(theta2)*sin(theta4) - 1.0*cos(theta2)*cos(theta3)*cos(theta4)) + cos(theta2)*sin(theta3)*sin(theta5)) - cos(theta7)*(1.0*cos(theta6)*(cos(theta5)*(cos(theta1)*cos(theta2)*sin(theta4) + cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*cos(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - sin(theta6)*(cos(theta1)*cos(theta2)*cos(theta4) - 1.0*cos(theta1)*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(cos(theta4)*sin(theta2) + cos(theta2)*cos(theta3)*sin(theta4)) + sin(theta7)*(sin(theta5)*(cos(theta1)*cos(theta2)*sin(theta4) + cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta1)*cos(theta5)*sin(theta2)*sin(theta3))))/(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) + 1.0*dirac(cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(sin(theta2)*sin(theta4) - 1.0*cos(theta2)*cos(theta3)*cos(theta4)) + cos(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta4)*sin(theta2) + cos(theta2)*cos(theta3)*sin(theta4))) - sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta1)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - cos(theta6)*(cos(theta2)*cos(theta4)*sin(theta1) - 1.0*cos(theta3)*sin(theta1)*sin(theta2)*sin(theta4)) + 1.0*cos(theta7)*(sin(theta5)*(sin(theta2)*sin(theta4) - 1.0*cos(theta2)*cos(theta3)*cos(theta4)) - 1.0*cos(theta2)*cos(theta5)*sin(theta3)))*(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    (0.25*np.sign(cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(sin(theta7)*(cos(theta6)*(sin(theta5)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta4)*sin(theta6)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*cos(theta7)*(cos(theta5)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta7)*(cos(theta5)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta4)*sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta6)*(cos(theta3)*sin(theta2)*sin(theta5) + cos(theta4)*cos(theta5)*sin(theta2)*sin(theta3)) + cos(theta7)*(cos(theta6)*(sin(theta5)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta4)*sin(theta6)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta6)*sin(theta2)*sin(theta3)*sin(theta4)))/(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) - 1.0*dirac(cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(sin(theta6)*(sin(theta5)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta3)*sin(theta2)*sin(theta5) + cos(theta4)*cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta2)*sin(theta3)*sin(theta4)*sin(theta6)) + cos(theta7)*(cos(theta3)*cos(theta5)*sin(theta2) - 1.0*cos(theta4)*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*sin(theta4)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)))*(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    - 1.0*dirac(cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(sin(theta7)*(sin(theta6)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + cos(theta5)*sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) + cos(theta7)*sin(theta5)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)))*(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) - (0.25*np.sign(cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(cos(theta7)*(sin(theta6)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2))) - 1.0*cos(theta6)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + sin(theta7)*(sin(theta6)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*sin(theta5)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) + sin(theta5)*sin(theta7)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))/(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    (0.25*np.sign(cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(sin(theta6)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta7)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta6)*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta6)*cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))))/(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) - 1.0*dirac(cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(sin(theta6)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)))*(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    dirac(cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta7)*(sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)))*(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) + (0.25*np.sign(cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(sin(theta7)*(1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - cos(theta7)*(cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))/(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    dirac(cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) + (0.25*np.sign(cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)))))/(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    (0.25*np.sign(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)))))/(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) - dirac(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    (0.25*np.sign(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta1)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4)*sin(theta1) - 1.0*cos(theta3)*sin(theta1)*sin(theta2)*sin(theta4))) + cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta1)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2)) + cos(theta5)*sin(theta1)*sin(theta2)*sin(theta3)) - 1.0*sin(theta6)*(cos(theta5)*(sin(theta2)*sin(theta4) - 1.0*cos(theta2)*cos(theta3)*cos(theta4)) + cos(theta2)*sin(theta3)*sin(theta5)) - cos(theta7)*(1.0*cos(theta6)*(cos(theta5)*(cos(theta1)*cos(theta2)*sin(theta4) + cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*cos(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - sin(theta6)*(cos(theta1)*cos(theta2)*cos(theta4) - 1.0*cos(theta1)*cos(theta3)*sin(theta2)*sin(theta4))) - 1.0*cos(theta6)*(cos(theta4)*sin(theta2) + cos(theta2)*cos(theta3)*sin(theta4)) + sin(theta7)*(sin(theta5)*(cos(theta1)*cos(theta2)*sin(theta4) + cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta1)*cos(theta5)*sin(theta2)*sin(theta3))))/(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) - 1.0*dirac(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(sin(theta6)*(cos(theta5)*(cos(theta1)*cos(theta2)*sin(theta4) + cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*cos(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(sin(theta2)*sin(theta4) - 1.0*cos(theta2)*cos(theta3)*cos(theta4)) + cos(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta4)*sin(theta2) + cos(theta2)*cos(theta3)*sin(theta4))) + cos(theta6)*(cos(theta1)*cos(theta2)*cos(theta4) - 1.0*cos(theta1)*cos(theta3)*sin(theta2)*sin(theta4)) + sin(theta7)*(sin(theta5)*(sin(theta2)*sin(theta4) - 1.0*cos(theta2)*cos(theta3)*cos(theta4)) - 1.0*cos(theta2)*cos(theta5)*sin(theta3)))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    (0.25*np.sign(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(sin(theta7)*(cos(theta6)*(sin(theta5)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta4)*sin(theta6)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*cos(theta7)*(cos(theta5)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta7)*(cos(theta5)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta4)*sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta3)*sin(theta2)*sin(theta5) + cos(theta4)*cos(theta5)*sin(theta2)*sin(theta3)) + cos(theta7)*(cos(theta6)*(sin(theta5)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta4)*sin(theta6)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta6)*sin(theta2)*sin(theta3)*sin(theta4)))/(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) + dirac(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(cos(theta7)*(cos(theta6)*(cos(theta3)*sin(theta2)*sin(theta5) + cos(theta4)*cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta2)*sin(theta3)*sin(theta4)*sin(theta6)) + sin(theta6)*(sin(theta5)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta3)*cos(theta5)*sin(theta2) - 1.0*cos(theta4)*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*sin(theta4)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    dirac(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(cos(theta6)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta7)*(sin(theta6)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta5)*sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + sin(theta5)*sin(theta7)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) - (0.25*np.sign(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(cos(theta7)*(sin(theta6)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2))) + cos(theta6)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + sin(theta7)*(sin(theta6)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*sin(theta5)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) + sin(theta5)*sin(theta7)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*cos(theta5)*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))/(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    dirac(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(sin(theta6)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) + (0.25*np.sign(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(sin(theta7)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta6)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta6)*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta6)*cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))))/(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    (0.25*np.sign(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(sin(theta7)*(1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - cos(theta7)*(cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + 1.0*cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))/(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) - 1.0*dirac(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*cos(theta7)*(sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    (0.25*np.sign(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)))))/(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) + dirac(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    dirac(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) - (0.25*np.sign(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)))))/(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    dirac(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta1)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2)) + cos(theta5)*sin(theta1)*sin(theta2)*sin(theta3)) + 1.0*sin(theta7)*(1.0*cos(theta6)*(cos(theta5)*(cos(theta1)*cos(theta2)*sin(theta4) + cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*cos(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - sin(theta6)*(cos(theta1)*cos(theta2)*cos(theta4) - 1.0*cos(theta1)*cos(theta3)*sin(theta2)*sin(theta4))) + cos(theta7)*(sin(theta5)*(cos(theta1)*cos(theta2)*sin(theta4) + cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta1)*cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta1)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4)*sin(theta1) - 1.0*cos(theta3)*sin(theta1)*sin(theta2)*sin(theta4))))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) - (0.25*np.sign(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta1)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4)*sin(theta1) - 1.0*cos(theta3)*sin(theta1)*sin(theta2)*sin(theta4))) + 1.0*cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta1)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta1)*sin(theta2)) + cos(theta5)*sin(theta1)*sin(theta2)*sin(theta3)) - sin(theta6)*(cos(theta5)*(sin(theta2)*sin(theta4) - 1.0*cos(theta2)*cos(theta3)*cos(theta4)) + cos(theta2)*sin(theta3)*sin(theta5)) + cos(theta7)*(1.0*cos(theta6)*(cos(theta5)*(cos(theta1)*cos(theta2)*sin(theta4) + cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*cos(theta1)*sin(theta2)*sin(theta3)*sin(theta5)) - sin(theta6)*(cos(theta1)*cos(theta2)*cos(theta4) - 1.0*cos(theta1)*cos(theta3)*sin(theta2)*sin(theta4))) - cos(theta6)*(cos(theta4)*sin(theta2) + cos(theta2)*cos(theta3)*sin(theta4)) - sin(theta7)*(sin(theta5)*(cos(theta1)*cos(theta2)*sin(theta4) + cos(theta1)*cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta1)*cos(theta5)*sin(theta2)*sin(theta3))))/(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    (0.25*np.sign(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(cos(theta7)*(cos(theta5)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta7)*(cos(theta6)*(sin(theta5)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta4)*sin(theta6)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta7)*(cos(theta5)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta4)*sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta6)*(cos(theta3)*sin(theta2)*sin(theta5) + cos(theta4)*cos(theta5)*sin(theta2)*sin(theta3)) + cos(theta7)*(cos(theta6)*(sin(theta5)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta4)*sin(theta6)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta6)*sin(theta2)*sin(theta3)*sin(theta4)))/(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) - 1.0*dirac(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(cos(theta7)*(cos(theta6)*(sin(theta5)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta4)*sin(theta6)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*cos(theta7)*(cos(theta5)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta4)*sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta5)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta7)*(cos(theta6)*(sin(theta5)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta4)*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta4)*sin(theta6)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    dirac(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(sin(theta7)*(sin(theta6)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2))) + cos(theta7)*(sin(theta6)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta5)*sin(theta7)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*cos(theta7)*sin(theta5)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) - (0.25*np.sign(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(cos(theta7)*(sin(theta6)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2))) - 1.0*cos(theta6)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta7)*(sin(theta6)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + cos(theta7)*sin(theta5)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) + sin(theta5)*sin(theta7)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))/(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    (0.25*np.sign(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(cos(theta7)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) + sin(theta7)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*cos(theta6)*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + cos(theta6)*cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))))/(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) - 1.0*dirac(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(sin(theta7)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*cos(theta7)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta6)*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta6)*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    - dirac(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(cos(theta7)*(1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - sin(theta7)*(cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) - (0.25*np.sign(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(1.0*sin(theta7)*(1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + cos(theta7)*(cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))))/(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2),
    (0.25*np.sign(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)))))/(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2) - 1.0*dirac(cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) + sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))))*(sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) + cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) + 1.0)**(1/2)])
    h = np.array(([h[0], h[1],  h[2],  h[3],  h[4],  h[5],  h[6]],
                [h[7], h[8],  h[9],  h[10],  h[11],  h[12],  h[13]],
                [h[14], h[15],  h[16],  h[17],  h[18],  h[19],  h[20]],
                [h[21], h[22],  h[23],  h[24],  h[25],  h[26],  h[27]],
                [h[28], h[29],  h[30],  h[31],  h[32],  h[33],  h[34]],
                [h[35], h[36],  h[37],  h[38],  h[39],  h[40],  h[41]],
                [h[42], h[43],  h[44],  h[45],  h[46],  h[47],  h[48]]))

    return h
# 脉冲函数
def dirac(x):
    if isinstance(x, (int, float)):
        if x == 0:
            return float('inf')
        else:
            return 0
    elif isinstance(x, np.ndarray):
        return np.zeros_like(x)
    else:
        raise ValueError("Unsupported input type. Only int, float, and numpy array are supported.")

# 正向运动学
def getTransform(joints : np.array):
    # 输入：关节角度
    # 输出：其次旋转矩阵
    theta1 = joints[0]
    theta2 = joints[1]
    theta3 = joints[2]
    theta4 = joints[3]
    theta5 = joints[4]
    theta6 = joints[5]
    theta7 = joints[6]
    FK = ([cos(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))),
    - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 1.0*sin(theta7)*(sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)))),
    cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))),
    0.4591*cos(theta1)*sin(theta2) - 0.065*sin(theta1)*sin(theta3) - 0.005*sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + 0.005*cos(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3)) - 0.1059*cos(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + 0.077*sin(theta6)*(sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) - 1.0*cos(theta1)*cos(theta4)*sin(theta2)) + 0.077*cos(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) + 0.0528*cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + 0.1059*sin(theta6)*(cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + cos(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta3)*sin(theta1) + cos(theta1)*cos(theta2)*sin(theta3))) - 0.4574*sin(theta4)*(sin(theta1)*sin(theta3) - 1.0*cos(theta1)*cos(theta2)*cos(theta3)) + 0.0528*cos(theta1)*sin(theta2)*sin(theta4) + 0.065*cos(theta1)*cos(theta2)*cos(theta3) + 0.4574*cos(theta1)*cos(theta4)*sin(theta2),
    cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))),
    - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) + sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2))) - 1.0*cos(theta7)*(sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) - 1.0*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))),
    cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 1.0*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))),
    0.077*cos(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 0.065*cos(theta1)*sin(theta3) - 0.4591*sin(theta1)*sin(theta2) + 0.1059*sin(theta6)*(cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + sin(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3))) - 0.1059*cos(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) + 0.077*sin(theta6)*(sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + cos(theta4)*sin(theta1)*sin(theta2)) - 0.005*sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 1.0*sin(theta1)*sin(theta2)*sin(theta4)) + 0.0528*cos(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) - 0.4574*sin(theta4)*(cos(theta1)*sin(theta3) + cos(theta2)*cos(theta3)*sin(theta1)) + 0.005*cos(theta5)*(cos(theta1)*cos(theta3) - 1.0*cos(theta2)*sin(theta1)*sin(theta3)) - 0.4574*cos(theta4)*sin(theta1)*sin(theta2) - 0.0528*sin(theta1)*sin(theta2)*sin(theta4) - 0.065*cos(theta2)*cos(theta3)*sin(theta1),
    cos(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))) - 1.0*sin(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)),
    - 1.0*cos(theta7)*(sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + cos(theta5)*sin(theta2)*sin(theta3)) - 1.0*sin(theta7)*(cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4))),
    - 1.0*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 1.0*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)),
    0.4591*cos(theta2) + 0.4574*cos(theta2)*cos(theta4) - 0.065*cos(theta3)*sin(theta2) + 0.0528*cos(theta2)*sin(theta4) + 0.077*cos(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) + 0.1059*sin(theta6)*(cos(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) - 1.0*sin(theta2)*sin(theta3)*sin(theta5)) - 0.005*sin(theta5)*(cos(theta2)*sin(theta4) + cos(theta3)*cos(theta4)*sin(theta2)) + 0.1059*cos(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) - 0.077*sin(theta6)*(cos(theta2)*cos(theta4) - 1.0*cos(theta3)*sin(theta2)*sin(theta4)) - 0.4574*cos(theta3)*sin(theta2)*sin(theta4) - 0.005*cos(theta5)*sin(theta2)*sin(theta3) + 0.0528*cos(theta3)*cos(theta4)*sin(theta2) + 0.29849999999998999555828049778938,
    0,
    0,
    0,
    1.0])
    trans = np.array(([FK[0],FK[1],FK[2],FK[3]],
                       [FK[4],FK[5],FK[6],FK[7]],
                       [FK[8],FK[9],FK[10],FK[11]],
                       [FK[12],FK[13],FK[14],FK[15]]))
    return trans

def tform2quat(T):
    # 提取旋转矩阵部分
    rotmat = T[:3, :3]
    trace = np.trace(rotmat)
    
    if trace > 0:
        S = sqrt(trace + 1.0) * 2
        qw = 0.25 * S
        qx = (rotmat[2, 1] - rotmat[1, 2]) / S
        qy = (rotmat[0, 2] - rotmat[2, 0]) / S
        qz = (rotmat[1, 0] - rotmat[0, 1]) / S
    elif rotmat[0, 0] > rotmat[1, 1] and rotmat[0, 0] > rotmat[2, 2]:
        S = sqrt(1.0 + rotmat[0, 0] - rotmat[1, 1] - rotmat[2, 2]) * 2
        qw = (rotmat[2, 1] - rotmat[1, 2]) / S
        qx = 0.25 * S
        qy = (rotmat[0, 1] + rotmat[1, 0]) / S
        qz = (rotmat[0, 2] + rotmat[2, 0]) / S
    elif rotmat[1, 1] > rotmat[2, 2]:
        S = sqrt(1.0 + rotmat[1, 1] - rotmat[0, 0] - rotmat[2, 2]) * 2
        qw = (rotmat[0, 2] - rotmat[2, 0]) / S
        qx = (rotmat[0, 1] + rotmat[1, 0]) / S
        qy = 0.25 * S
        qz = (rotmat[1, 2] + rotmat[2, 1]) / S
    else:
        S = sqrt(1.0 + rotmat[2, 2] - rotmat[0, 0] - rotmat[1, 1]) * 2
        qw = (rotmat[1, 0] - rotmat[0, 1]) / S
        qx = (rotmat[0, 2] + rotmat[2, 0]) / S
        qy = (rotmat[1, 2] + rotmat[2, 1]) / S
        qz = 0.25 * S

    quat = -np.array([qw, qx, qy, qz])

    return quat