## Lie derivative of a large expression...

I want to compute the Lie derivative of a large expression in maple.
The expression is attached, there are 20 vars in total. But Maple cannot do that (after 7hrs of working!), but this is doable with another math tool which first turns the expression into subexpressions.
However, I want to do this in Maple.
I have already tried to simplify/combine/factor/use the Lie algebra package, none of them helped.
Any suggestion is highly appreciated

(6*m__1*(2*x[13]*x[12]*((x[12]*(cos(x[7])^2 - 2)*(x[17] - g__1)*cos(x[8])^2 - 2*x[12]*(x[17] - g__1)*cos(x[7])^2 + x[18]*cos(x[7])*sin(x[7])*sin(x[8]) + x[12]*(x[17] - g__1))*cos(x[6])^2 - 2*cos(x[8])*(x[12]*sin(x[8])*(x[17] - g__1)*sin(x[7]) + x[18]*cos(x[7])/2)*sin(x[6])*cos(x[6]) + x[12]*cos(x[8])^2*(x[17] - g__1))*cos(x[4])^5 + ((-x[12]*x[13]*x[18]*sin(x[4])*(cos(x[7])^2 - 2)*cos(x[8])^2 + (((x[17] - g__1)*x[12]^2 + (2*x[17] - 2*g__1)*x[13]^2 - x[19])*x[12]*sin(x[8])*cos(x[7])^2 - 3*(x[12]^2*x[18] - (2*x[20])/9)*sin(x[7])*cos(x[7])/2 - 2*((x[17] - g__1)*x[12]^2 + (2*x[17] - 2*g__1)*x[13]^2 - x[19])*x[12]*sin(x[8]))*cos(x[8]) + 4*(x[18]*cos(x[7])^2/2 + x[12]*sin(x[7])*sin(x[8])*(x[17] - g__1)*cos(x[7]) - x[18]/4)*sin(x[4])*x[13]*x[12])*cos(x[6])^2 + (2*((x[17] - g__1)*x[12]^2 + (2*x[17] - 2*g__1)*x[13]^2 - x[19])*sin(x[7])*x[12]*sin(x[6])*cos(x[8])^2 - 4*(x[12]*x[13]*sin(x[4])*sin(x[6])*(x[17] - g__1)*cos(x[7]) - x[13]*x[18]*sin(x[4])*sin(x[6])*sin(x[7])*sin(x[8])/2 - x[12]*x[15]*(x[17] - g__1)/24)*x[12]*cos(x[8]) - (3*(x[12]^2*x[18] - (2*x[20])/9)*sin(x[8])*cos(x[7])/2 + ((x[17] - g__1)*x[12]^2 + (2*x[17] - 2*g__1)*x[13]^2 - x[19])*sin(x[7])*x[12])*sin(x[6]))*cos(x[6]) + x[12]*(-x[13]*x[18]*cos(x[8])^2*sin(x[4]) + ((x[17] - g__1)*x[12]^2 + (2*x[17] - 2*g__1)*x[13]^2 - x[19])*sin(x[8])*cos(x[8]) + x[12]*sin(x[8])*(x[17] - g__1)*(sin(x[6])*sin(x[7])*x[15] + x[14]*cos(x[7]))/6))*cos(x[4])^4 + ((-5*x[12]^2*x[13]*(cos(x[7])^2 - 2)*(x[17] - g__1)*cos(x[8])^2 - sin(x[4])*(3*(x[12]^2*x[18] - (2*x[20])/9)*sin(x[8])*cos(x[7])^2/2 + ((x[17] - g__1)*x[12]^2 + (2*x[17] - 2*g__1)*x[13]^2 - x[19])*sin(x[7])*x[12]*cos(x[7]) - 3*(x[12]^2*x[18] - (2*x[20])/9)*sin(x[8]))*cos(x[8]) + 7*(x[12]*(x[17] - g__1)*cos(x[7])^2 - (2*x[18]*cos(x[7])*sin(x[7])*sin(x[8]))/7 - (5*x[12]*(x[17] - g__1))/7)*x[13]*x[12])*cos(x[6])^2 - (3*sin(x[4])*(x[12]^2*x[18] - (2*x[20])/9)*sin(x[7])*cos(x[8])^2 - 10*(x[18]*cos(x[7])/5 + x[12]*sin(x[8])*(x[17] - g__1)*sin(x[7]))*x[13]*x[12]*cos(x[8]) + sin(x[4])*(((x[17] - g__1)*x[12]^2 + (2*x[17] - 2*g__1)*x[13]^2 - x[19])*x[12]*sin(x[8])*cos(x[7]) - 3*(x[12]^2*x[18] - (2*x[20])/9)*sin(x[7])/2))*sin(x[6])*cos(x[6]) - 5*x[12]^2*x[13]*(x[17] - g__1)*cos(x[8])^2 - (3*sin(x[4])*(x[12]^2*x[18] - (2*x[20])/9)*sin(x[8])*cos(x[8]))/2 + (x[17] - g__1)*(x[15]*cos(x[7])*sin(x[4])*sin(x[6])/6 - x[14]*sin(x[4])*sin(x[7])/6 + x[13])*x[12]^2)*cos(x[4])^3 - (7*x[12]*((-(4*x[13]*x[18]*sin(x[4])*(cos(x[7])^2 - 2)*cos(x[8])^2)/7 + (((x[17] - g__1)*x[12]^2 + ((4*x[17])/7 - (4*g__1)/7)*x[13]^2 - (2*x[19])/7)*sin(x[8])*cos(x[7])^2 - (5*x[12]*x[18]*cos(x[7])*sin(x[7]))/7 - 2*((x[17] - g__1)*x[12]^2 + ((4*x[17])/7 - (4*g__1)/7)*x[13]^2 - (2*x[19])/7)*sin(x[8]))*cos(x[8]) + 10*(x[18]*cos(x[7])^2/5 + x[12]*sin(x[7])*sin(x[8])*(x[17] - g__1)*cos(x[7]) - (2*x[18])/5)*sin(x[4])*x[13]/7)*cos(x[6])^2 + (2*((x[17] - g__1)*x[12]^2 + ((4*x[17])/7 - (4*g__1)/7)*x[13]^2 - (2*x[19])/7)*sin(x[7])*sin(x[6])*cos(x[8])^2 + (-(10*x[12]*x[13]*sin(x[4])*sin(x[6])*(x[17] - g__1)*cos(x[7]))/7 + (8*x[13]*x[18]*sin(x[4])*sin(x[6])*sin(x[7])*sin(x[8]))/7 + x[12]*x[15]*(x[17] - g__1)/21)*cos(x[8]) - ((5*x[12]*x[18]*cos(x[7])*sin(x[8]))/7 + ((x[17] - g__1)*x[12]^2 + ((4*x[17])/7 - (4*g__1)/7)*x[13]^2 - (2*x[19])/7)*sin(x[7]))*sin(x[6]))*cos(x[6]) - (4*x[13]*x[18]*cos(x[8])^2*sin(x[4]))/7 + ((x[17] - g__1)*x[12]^2 + ((4*x[17])/7 - (4*g__1)/7)*x[13]^2 - (2*x[19])/7)*sin(x[8])*cos(x[8]) + x[12]*x[14]*sin(x[8])*(x[17] - g__1)*cos(x[7])/21 + (2*x[13]*x[18]*sin(x[4]))/7 + x[12]*x[15]*sin(x[6])*sin(x[7])*sin(x[8])*(x[17] - g__1)/21)*cos(x[4])^2)/2 + 3*(((4*x[13]*(cos(x[7])^2 - 2)*(x[17] - g__1)*cos(x[8])^2)/3 + sin(x[4])*((2*x[18]*cos(x[7])^2*sin(x[8]))/3 + x[12]*sin(x[7])*(x[17] - g__1)*cos(x[7]) - (4*x[18]*sin(x[8]))/3)*cos(x[8]) - (2*x[13]*(cos(x[7])^2 - 2)*(x[17] - g__1))/3)*cos(x[6])^2 + ((4*x[18]*cos(x[8])^2*sin(x[4])*sin(x[7]))/3 - (8*x[13]*sin(x[7])*sin(x[8])*(x[17] - g__1)*cos(x[8]))/3 + (x[12]*sin(x[8])*(x[17] - g__1)*cos(x[7]) - (2*x[18]*sin(x[7]))/3)*sin(x[4]))*sin(x[6])*cos(x[6]) + (4*x[13]*(x[17] - g__1)*cos(x[8])^2)/3 + (2*x[18]*cos(x[8])*sin(x[4])*sin(x[8]))/3 - (2*x[13]*(x[17] - g__1))/3)*x[12]^2*cos(x[4]) + 2*(x[17] - g__1)*(cos(x[8])*sin(x[8])*(cos(x[7])^2 - 2)*cos(x[6])^2 + 2*(cos(x[8])^2 - 1/2)*sin(x[7])*sin(x[6])*cos(x[6]) + cos(x[8])*sin(x[8]))*x[12]^3)*L*cos(x[5])^6 + (12*m__1*sin(x[5])*((-((x[12]^2*x[18] - x[20]/6)*(cos(x[7])^2 - 2)*cos(x[8])^2)/2 + (x[12]^2*x[18] - x[20]/6)*cos(x[7])^2 + sin(x[7])*((x[17] - g__1)*x[12]^2 + (x[17] - g__1)*x[13]^2 - x[19]/2)*x[12]*sin(x[8])*cos(x[7]) - x[12]^2*x[18]/2 + x[20]/12)*cos(x[6])^2 - (((x[17] - g__1)*x[12]^2 + (x[17] - g__1)*x[13]^2 - x[19]/2)*x[12]*cos(x[7]) - (x[12]^2*x[18] - x[20]/6)*sin(x[7])*sin(x[8]))*cos(x[8])*sin(x[6])*cos(x[6]) - cos(x[8])^2*(x[12]^2*x[18] - x[20]/6)/2)*L*cos(x[4])^5 - 6*m__1*sin(x[5])*((sin(x[4])*(cos(x[7])^2 - 2)*((x[17] - g__1)*x[12]^2 + (x[17] - g__1)*x[13]^2 - x[19]/2)*x[12]*cos(x[8])^2 + 3*x[13]*((2*x[18]*cos(x[7])^2*sin(x[8]))/3 + x[12]*sin(x[7])*(x[17] - g__1)*cos(x[7]) - (4*x[18]*sin(x[8]))/3)*x[12]*cos(x[8]) - 2*sin(x[4])*(((x[17] - g__1)*x[12]^2 + (x[17] - g__1)*x[13]^2 - x[19]/2)*x[12]*cos(x[7])^2 - (x[12]^2*x[18] - x[20]/6)*sin(x[7])*sin(x[8])*cos(x[7]) - (((x[17] - g__1)*x[12]^2 + (x[17] - g__1)*x[13]^2 - x[19]/2)*x[12])/2))*cos(x[6])^2 - 2*(-2*x[12]*x[13]*x[18]*cos(x[8])^2*sin(x[7]) + sin(x[4])*((x[12]^2*x[18] - x[20]/6)*cos(x[7]) + sin(x[7])*((x[17] - g__1)*x[12]^2 + (x[17] - g__1)*x[13]^2 - x[19]/2)*x[12]*sin(x[8]))*cos(x[8]) - 3*(x[12]*sin(x[8])*(x[17] - g__1)*cos(x[7]) - (2*x[18]*sin(x[7]))/3)*x[13]*x[12]/2)*sin(x[6])*cos(x[6]) + cos(x[8])*(sin(x[4])*((x[17] - g__1)*x[12]^2 + (x[17] - g__1)*x[13]^2 - x[19]/2)*cos(x[8]) + 2*x[13]*x[18]*sin(x[8]))*x[12])*L*cos(x[4])^4 + ((15*m__1*sin(x[5])*(cos(x[7])^2 - 2)*(x[12]^2*x[18] - (2*x[20])/15)*L*cos(x[8])^2 - 18*x[12]*((x[17] - g__1)*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - 2*(m__1 + m__p)*(x[17] - g__1)/9)*sin(x[8])*cos(x[7])^2 - (2*L*x[13]*x[18]*cos(x[7])*sin(x[4])*sin(x[5])*sin(x[7])*m__1)/3 - 2*(x[17] - g__1)*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - 2*(m__1 + m__p)*(x[17] - g__1)/9)*sin(x[8]))*cos(x[8]) - 33*m__1*sin(x[5])*(((7*x[12]^2*x[18])/11 - x[20]/33)*cos(x[7])^2 + ((x[17] - g__1)*x[12]^2 + ((4*x[17])/11 - (4*g__1)/11)*x[13]^2 - (2*x[19])/11)*sin(x[7])*x[12]*sin(x[8])*cos(x[7]) - (5*x[12]^2*x[18])/11 + (2*x[20])/33)*L)*cos(x[6])^2 + 33*(-12*(x[17] - g__1)*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - 2*(m__1 + m__p)*(x[17] - g__1)/9)*sin(x[7])*x[12]*cos(x[8])^2/11 + m__1*sin(x[5])*(((x[17] - g__1)*x[12]^2 + ((4*x[17])/11 - (4*g__1)/11)*x[13]^2 - (2*x[19])/11)*x[12]*cos(x[7]) - 10*(x[12]^2*x[18] - (2*x[20])/15)*sin(x[7])*sin(x[8])/11)*L*cos(x[8]) + (6*x[12]*((2*L*x[13]*x[18]*cos(x[7])*sin(x[4])*sin(x[5])*sin(x[8])*m__1)/3 + (x[17] - g__1)*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - 2*(m__1 + m__p)*(x[17] - g__1)/9)*sin(x[7])))/11)*sin(x[6])*cos(x[6]) + 15*m__1*sin(x[5])*(x[12]^2*x[18] - (2*x[20])/15)*L*cos(x[8])^2 - 18*(x[17] - g__1)*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - 2*(m__1 + m__p)*(x[17] - g__1)/9)*x[12]*sin(x[8])*cos(x[8]) - 3*(x[12]^2*x[18] - x[20]/3)*m__1*sin(x[5])*L)*cos(x[4])^3 + 15*x[12]*((m__1*sin(x[4])*sin(x[5])*(cos(x[7])^2 - 2)*L*((x[17] - g__1)*x[12]^2 + ((4*x[17])/5 - (4*g__1)/5)*x[13]^2 - (2*x[19])/5)*cos(x[8])^2 + ((4*L*x[13]*x[18]*cos(x[7])^2*sin(x[5])*sin(x[8])*m__1)/5 + 2*(x[17] - g__1)*sin(x[7])*(L*x[12]*x[13]*sin(x[5])*m__1 - (2*sin(x[4])*(m__1 + m__p)*(x[17] - g__1))/15)*cos(x[7]) - (8*L*x[13]*x[18]*sin(x[5])*sin(x[8])*m__1)/5)*cos(x[8]) - (9*m__1*sin(x[4])*(((x[17] - g__1)*x[12]^2 + ((2*x[17])/9 - (2*g__1)/9)*x[13]^2 - x[19]/9)*cos(x[7])^2 - (5*x[12]*x[18]*cos(x[7])*sin(x[7])*sin(x[8]))/9 + (-(5*x[17])/9 + (5*g__1)/9)*x[12]^2 + (-(4*x[17])/9 + (4*g__1)/9)*x[13]^2 + (2*x[19])/9)*sin(x[5])*L)/5)*cos(x[6])^2 + ((8*L*x[13]*x[18]*cos(x[8])^2*sin(x[5])*sin(x[6])*sin(x[7])*m__1)/5 - 2*(x[12]*x[18]*cos(x[7])/2 + sin(x[7])*((x[17] - g__1)*x[12]^2 + ((4*x[17])/5 - (4*g__1)/5)*x[13]^2 - (2*x[19])/5)*sin(x[8]))*m__1*sin(x[4])*sin(x[5])*L*sin(x[6])*cos(x[8]) + 2*(x[17] - g__1)*(L*x[12]*x[13]*sin(x[5])*m__1 - (2*sin(x[4])*(m__1 + m__p)*(x[17] - g__1))/15)*sin(x[8])*sin(x[6])*cos(x[7]) - m__1*(x[12]*x[15]*sin(x[8])*(x[17] - g__1)*sin(x[4]) + 12*x[13]*x[18]*sin(x[6])*sin(x[7]))*sin(x[5])*L/15)*cos(x[6]) + m__1*sin(x[5])*(sin(x[4])*((x[17] - g__1)*x[12]^2 + ((4*x[17])/5 - (4*g__1)/5)*x[13]^2 - (2*x[19])/5)*cos(x[8])^2 + (x[12]*x[14]*sin(x[4])*(x[17] - g__1)*cos(x[7])/15 + x[12]*x[15]*sin(x[6])*sin(x[7])*(x[17] - g__1)*sin(x[4])/15 + (4*x[13]*x[18]*sin(x[8]))/5)*cos(x[8]) - sin(x[4])*((x[17] - g__1)*x[12]^2 + (2*x[17] - 2*g__1)*x[13]^2 - x[19])/5)*L)*cos(x[4])^2 + 18*x[12]*((-(2*L*x[12]*x[18]*sin(x[5])*m__1*(cos(x[7])^2 - 2)*cos(x[8])^2)/3 + 4*(x[17] - g__1)*(cos(x[7])^2 - 2)*sin(x[8])*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/6)*cos(x[8])/3 + m__1*sin(x[5])*x[12]*L*(x[18]*cos(x[7])^2/3 + x[12]*sin(x[7])*sin(x[8])*(x[17] - g__1)*cos(x[7]) - (2*x[18])/3))*cos(x[6])^2 - (-8*(x[17] - g__1)*sin(x[7])*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/6)*cos(x[8])^2/3 + m__1*sin(x[5])*(x[12]*cos(x[7])*(x[17] - g__1) - (4*x[18]*sin(x[7])*sin(x[8]))/3)*x[12]*L*cos(x[8]) + 4*(x[17] - g__1)*sin(x[7])*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/6)/3)*sin(x[6])*cos(x[6]) - (2*L*x[12]*x[18]*cos(x[8])^2*sin(x[5])*m__1)/3 + 4*(x[17] - g__1)*sin(x[8])*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/6)*cos(x[8])/3 + L*x[12]*x[18]*sin(x[5])*m__1/3)*cos(x[4]) - 12*(x[17] - g__1)*m__1*sin(x[4])*sin(x[5])*x[12]^3*L*((cos(x[8])^2 - 1/2)*(cos(x[7])^2 - 2)*cos(x[6])^2 - 2*cos(x[6])*sin(x[7])*cos(x[8])*sin(x[6])*sin(x[8]) + cos(x[8])^2 - 1/2))*cos(x[5])^5 + (-18*m__1*x[13]*L*(((cos(x[7])^2 - 2)*((x[17] - g__1)*x[12]^2 + (x[17]/3 - g__1/3)*x[13]^2 - x[19]/6)*cos(x[8])^2 + ((-2*x[17] + 2*g__1)*x[12]^2 + (-(2*x[17])/3 + (2*g__1)/3)*x[13]^2 + x[19]/3)*cos(x[7])^2 + (4*x[12]*x[18]*cos(x[7])*sin(x[7])*sin(x[8]))/3 + (x[17] - g__1)*x[12]^2 + (x[17]/3 - g__1/3)*x[13]^2 - x[19]/6)*cos(x[6])^2 - 2*((2*x[12]*x[18]*cos(x[7]))/3 + sin(x[7])*sin(x[8])*((x[17] - g__1)*x[12]^2 + (x[17]/3 - g__1/3)*x[13]^2 - x[19]/6))*cos(x[8])*sin(x[6])*cos(x[6]) + cos(x[8])^2*((x[17] - g__1)*x[12]^2 + (x[17]/3 - g__1/3)*x[13]^2 - x[19]/6))*cos(x[4])^5 + ((12*L*sin(x[4])*m__1*x[12]*x[13]*x[18]*(cos(x[7])^2 - 2)*cos(x[8])^2 - 12*m__1*L*(((x[17] - g__1)*x[12]^2 + ((9*x[17])/2 - (9*g__1)/2)*x[13]^2 - x[19]/2)*x[12]*sin(x[8])*cos(x[7])^2 - sin(x[7])*(x[12]^2*x[18] + 5/4*x[13]^2*x[18] - 1/6*x[20])*cos(x[7]) - 2*((x[17] - g__1)*x[12]^2 + ((9*x[17])/2 - (9*g__1)/2)*x[13]^2 - x[19]/2)*x[12]*sin(x[8]))*cos(x[8]) - 24*L*x[12]*x[13]*x[18]*cos(x[7])^2*sin(x[4])*m__1 - 36*sin(x[7])*(-x[12]*(x[17] - g__1)^2*(m__1 + m__p)*sin(x[5])/9 + m__1*sin(x[4])*x[13]*L*((x[17] - g__1)*x[12]^2 + (x[17]/3 - g__1/3)*x[13]^2 - x[19]/6))*sin(x[8])*cos(x[7]) + 12*L*sin(x[4])*m__1*x[12]*x[13]*x[18])*cos(x[6])^2 + (-24*m__1*((x[17] - g__1)*x[12]^2 + ((9*x[17])/2 - (9*g__1)/2)*x[13]^2 - x[19]/2)*sin(x[7])*x[12]*L*sin(x[6])*cos(x[8])^2 + (36*(-x[12]*(x[17] - g__1)^2*(m__1 + m__p)*sin(x[5])/9 + m__1*sin(x[4])*x[13]*L*((x[17] - g__1)*x[12]^2 + (x[17]/3 - g__1/3)*x[13]^2 - x[19]/6))*sin(x[6])*cos(x[7]) - 24*m__1*(x[12]*x[18]*sin(x[4])*sin(x[6])*sin(x[7])*sin(x[8]) - x[13]*x[15]*(x[17] - g__1)/24)*x[13]*L)*cos(x[8]) + 12*m__1*(sin(x[8])*(x[12]^2*x[18] + 5/4*x[13]^2*x[18] - 1/6*x[20])*cos(x[7]) + ((x[17] - g__1)*x[12]^2 + ((9*x[17])/2 - (9*g__1)/2)*x[13]^2 - x[19]/2)*sin(x[7])*x[12])*L*sin(x[6]))*cos(x[6]) - 12*m__1*(-x[12]*x[13]*x[18]*cos(x[8])^2*sin(x[4]) + ((x[17] - g__1)*x[12]^2 + ((9*x[17])/2 - (9*g__1)/2)*x[13]^2 - x[19]/2)*x[12]*sin(x[8])*cos(x[8]) - x[13]^2*sin(x[8])*(x[17] - g__1)*(sin(x[6])*sin(x[7])*x[15] + x[14]*cos(x[7]))/12)*L)*cos(x[4])^4 + ((63*(cos(x[7])^2 - 2)*(-(2*x[12]*sin(x[4])*(x[17] - g__1)^2*(m__1 + m__p)*sin(x[5]))/63 + m__1*x[13]*L*((x[17] - g__1)*x[12]^2 + ((2*x[17])/7 - (2*g__1)/7)*x[13]^2 - (2*x[19])/21))*cos(x[8])^2 + 12*m__1*sin(x[4])*(sin(x[8])*(x[12]^2*x[18] + 5/4*x[13]^2*x[18] - 1/6*x[20])*cos(x[7])^2 + ((x[17] - g__1)*x[12]^2 + ((9*x[17])/2 - (9*g__1)/2)*x[13]^2 - x[19]/2)*sin(x[7])*x[12]*cos(x[7]) - 2*sin(x[8])*(x[12]^2*x[18] + 5/4*x[13]^2*x[18] - 1/6*x[20]))*L*cos(x[8]) + (4*x[12]*sin(x[4])*(x[17] - g__1)^2*(m__1 + m__p)*sin(x[5]) - 63*m__1*((x[17] - g__1)*x[12]^2 - x[19]/21)*x[13]*L)*cos(x[7])^2 + 24*L*x[12]*x[13]*x[18]*cos(x[7])*sin(x[7])*sin(x[8])*m__1 - 2*x[12]*sin(x[4])*(x[17] - g__1)^2*(m__1 + m__p)*sin(x[5]) + 63*m__1*x[13]*L*((x[17] - g__1)*x[12]^2 + ((2*x[17])/7 - (2*g__1)/7)*x[13]^2 - (2*x[19])/21))*cos(x[6])^2 + 12*(2*m__1*sin(x[4])*sin(x[7])*L*(x[12]^2*x[18] + 5/4*x[13]^2*x[18] - 1/6*x[20])*cos(x[8])^2 + (-2*L*x[12]*x[13]*x[18]*cos(x[7])*m__1 - (21*sin(x[7])*(-(2*x[12]*sin(x[4])*(x[17] - g__1)^2*(m__1 + m__p)*sin(x[5]))/63 + m__1*x[13]*L*((x[17] - g__1)*x[12]^2 + ((2*x[17])/7 - (2*g__1)/7)*x[13]^2 - (2*x[19])/21))*sin(x[8]))/2)*cos(x[8]) + m__1*sin(x[4])*(((x[17] - g__1)*x[12]^2 + ((9*x[17])/2 - (9*g__1)/2)*x[13]^2 - x[19]/2)*x[12]*sin(x[8])*cos(x[7]) - sin(x[7])*(x[12]^2*x[18] + 5/4*x[13]^2*x[18] - 1/6*x[20]))*L)*sin(x[6])*cos(x[6]) + (-2*x[12]*sin(x[4])*(x[17] - g__1)^2*(m__1 + m__p)*sin(x[5]) + 63*m__1*x[13]*L*((x[17] - g__1)*x[12]^2 + ((2*x[17])/7 - (2*g__1)/7)*x[13]^2 - (2*x[19])/21))*cos(x[8])^2 + 12*m__1*sin(x[4])*L*(x[12]^2*x[18] + 5/4*x[13]^2*x[18] - 1/6*x[20])*sin(x[8])*cos(x[8]) - 27*m__1*x[13]*(-x[13]*x[15]*sin(x[4])*sin(x[6])*(x[17] - g__1)*cos(x[7])/27 + x[13]*x[14]*sin(x[7])*(x[17] - g__1)*sin(x[4])/27 + (x[17] - g__1)*x[12]^2 + ((4*x[17])/9 - (4*g__1)/9)*x[13]^2 - x[19]/9)*L)*cos(x[4])^3 + ((-30*L*sin(x[4])*m__1*x[12]*x[13]*x[18]*(cos(x[7])^2 - 2)*cos(x[8])^2 + 24*m__1*(((x[17] - g__1)*x[12]^2 + ((17*x[17])/8 - (17*g__1)/8)*x[13]^2 - x[19]/4)*x[12]*sin(x[8])*cos(x[7])^2 - (5*sin(x[7])*x[18]*(x[12]^2 - x[13]^2/5)*cos(x[7]))/8 - 2*((x[17] - g__1)*x[12]^2 + ((17*x[17])/8 - (17*g__1)/8)*x[13]^2 - x[19]/4)*x[12]*sin(x[8]))*L*cos(x[8]) + 12*L*x[12]*x[13]*x[18]*cos(x[7])^2*sin(x[4])*m__1 + 45*(x[17] - g__1)*sin(x[7])*(-(4*x[12]*(m__1 + m__p)*(x[17] - g__1)*sin(x[5]))/45 + L*x[13]*sin(x[4])*m__1*(x[12]^2 - (2*x[13]^2)/15))*sin(x[8])*cos(x[7]) - 30*L*sin(x[4])*m__1*x[12]*x[13]*x[18])*cos(x[6])^2 + (48*m__1*sin(x[7])*((x[17] - g__1)*x[12]^2 + ((17*x[17])/8 - (17*g__1)/8)*x[13]^2 - x[19]/4)*x[12]*L*sin(x[6])*cos(x[8])^2 + (-45*(x[17] - g__1)*(-(4*x[12]*(m__1 + m__p)*(x[17] - g__1)*sin(x[5]))/45 + L*x[13]*sin(x[4])*m__1*(x[12]^2 - (2*x[13]^2)/15))*sin(x[6])*cos(x[7]) + m__1*(60*x[12]*x[13]*x[18]*sin(x[4])*sin(x[6])*sin(x[7])*sin(x[8]) + x[15]*(x[12] - x[13])*(x[12] + x[13])*(x[17] - g__1))*L)*cos(x[8]) - 24*m__1*((5*x[18]*sin(x[8])*(x[12]^2 - x[13]^2/5)*cos(x[7]))/8 + sin(x[7])*((x[17] - g__1)*x[12]^2 + ((17*x[17])/8 - (17*g__1)/8)*x[13]^2 - x[19]/4)*x[12])*L*sin(x[6]))*cos(x[6]) + 24*m__1*(-(5*x[12]*x[13]*x[18]*cos(x[8])^2*sin(x[4]))/4 + ((x[17] - g__1)*x[12]^2 + ((17*x[17])/8 - (17*g__1)/8)*x[13]^2 - x[19]/4)*x[12]*sin(x[8])*cos(x[8]) + x[14]*sin(x[8])*(x[12] - x[13])*(x[12] + x[13])*(x[17] - g__1)*cos(x[7])/24 + (3*x[12]*x[13]*x[18]*sin(x[4]))/4 + x[15]*sin(x[6])*sin(x[7])*sin(x[8])*(x[12] - x[13])*(x[12] + x[13])*(x[17] - g__1)/24)*L)*cos(x[4])^2 - 18*x[12]*((8*(x[17] - g__1)*(cos(x[7])^2 - 2)*(-sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5])/12 + L*x[12]*x[13]*m__1)*cos(x[8])^2/3 + m__1*sin(x[4])*((2*x[12]*x[18]*cos(x[7])^2*sin(x[8]))/3 + (x[17] - g__1)*(x[12]^2 - x[13]^2/3)*sin(x[7])*cos(x[7]) - (4*x[12]*x[18]*sin(x[8]))/3)*L*cos(x[8]) - (x[17] - g__1)*((-sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5])/9 + L*x[12]*x[13]*m__1)*cos(x[7])^2 + (2*sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5]))/9 - (8*L*x[12]*x[13]*m__1)/3))*cos(x[6])^2 + ((4*L*x[12]*x[18]*cos(x[8])^2*sin(x[4])*sin(x[7])*m__1)/3 - 16*(x[17] - g__1)*sin(x[7])*sin(x[8])*(-sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5])/12 + L*x[12]*x[13]*m__1)*cos(x[8])/3 + m__1*sin(x[4])*((x[17] - g__1)*(x[12]^2 - x[13]^2/3)*sin(x[8])*cos(x[7]) - (2*x[12]*x[18]*sin(x[7]))/3)*L)*sin(x[6])*cos(x[6]) + 8*(x[17] - g__1)*(-sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5])/12 + L*x[12]*x[13]*m__1)*cos(x[8])^2/3 + (2*L*x[12]*x[18]*cos(x[8])*sin(x[4])*sin(x[8])*m__1)/3 - 5*(x[17] - g__1)*(-sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5])/15 + L*x[12]*x[13]*m__1)/3)*cos(x[4]) - 12*(x[17] - g__1)*m__1*(cos(x[8])*sin(x[8])*(cos(x[7])^2 - 2)*cos(x[6])^2 + 2*(cos(x[8])^2 - 1/2)*sin(x[7])*sin(x[6])*cos(x[6]) + cos(x[8])*sin(x[8]))*x[12]^3*L)*cos(x[5])^4 + (-36*m__1*sin(x[5])*x[13]^2*((-x[18]*(cos(x[7])^2 - 2)*cos(x[8])^2/6 + x[18]*cos(x[7])^2/3 + x[12]*sin(x[7])*sin(x[8])*(x[17] - g__1)*cos(x[7]) - x[18]/6)*cos(x[6])^2 - cos(x[8])*(x[12]*cos(x[7])*(x[17] - g__1) - x[18]*sin(x[7])*sin(x[8])/3)*sin(x[6])*cos(x[6]) - x[18]*cos(x[8])^2/6)*L*cos(x[4])^5 + 36*((((x[17] - g__1)*(cos(x[7])^2 - 2)*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/9)*cos(x[8])^2)/2 + m__1*sin(x[5])*((2*x[12]*x[18]*cos(x[7])^2*sin(x[8]))/3 + sin(x[7])*((x[17] - g__1)*x[12]^2 + (x[17]/2 - g__1/2)*x[13]^2 - x[19]/6)*cos(x[7]) - (4*x[12]*x[18]*sin(x[8]))/3)*L*cos(x[8]) - (x[17] - g__1)*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/9)*cos(x[7])^2 + L*x[13]*x[18]*cos(x[7])*sin(x[4])*sin(x[5])*sin(x[7])*sin(x[8])*m__1/3 + ((x[17] - g__1)*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/9))/2)*cos(x[6])^2 + ((4*L*x[12]*x[18]*cos(x[8])^2*sin(x[5])*sin(x[7])*m__1)/3 + (-L*x[13]*x[18]*cos(x[7])*sin(x[4])*sin(x[5])*m__1/3 - (x[17] - g__1)*sin(x[7])*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/9)*sin(x[8]))*cos(x[8]) + m__1*sin(x[5])*L*(sin(x[8])*((x[17] - g__1)*x[12]^2 + (x[17]/2 - g__1/2)*x[13]^2 - x[19]/6)*cos(x[7]) - (2*x[12]*x[18]*sin(x[7]))/3))*sin(x[6])*cos(x[6]) + cos(x[8])*((x[17] - g__1)*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/9)*cos(x[8]) + (4*L*x[12]*x[18]*sin(x[5])*sin(x[8])*m__1)/3)/2)*x[13]*cos(x[4])^4 + ((-6*m__1*sin(x[5])*(cos(x[7])^2 - 2)*L*(x[12]^2*x[18] + 5/2*x[13]^2*x[18] - 1/6*x[20])*cos(x[8])^2 + (36*(m__1*sin(x[4])*x[13]*L*((x[17] - g__1)*x[12]^2 + (x[17]/2 - g__1/2)*x[13]^2 - x[19]/6)*sin(x[5]) - (11*x[12]*(x[17] - g__1)^2*(m__1 + m__p))/36)*sin(x[8])*cos(x[7])^2 - 24*sin(x[7])*x[18]*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/6)*cos(x[7]) - 72*(m__1*sin(x[4])*x[13]*L*((x[17] - g__1)*x[12]^2 + (x[17]/2 - g__1/2)*x[13]^2 - x[19]/6)*sin(x[5]) - (11*x[12]*(x[17] - g__1)^2*(m__1 + m__p))/36)*sin(x[8]))*cos(x[8]) + 3*L*x[13]^2*x[18]*cos(x[7])^2*sin(x[5])*m__1 + 27*(x[17] - g__1)*x[13]*sin(x[7])*(L*x[12]*x[13]*sin(x[5])*m__1 - (4*sin(x[4])*(m__1 + m__p)*(x[17] - g__1))/27)*sin(x[8])*cos(x[7]) - 6*m__1*sin(x[5])*L*(x[12]^2*x[18] + 5/2*x[13]^2*x[18] - 1/6*x[20]))*cos(x[6])^2 + (72*(m__1*sin(x[4])*x[13]*L*((x[17] - g__1)*x[12]^2 + (x[17]/2 - g__1/2)*x[13]^2 - x[19]/6)*sin(x[5]) - (11*x[12]*(x[17] - g__1)^2*(m__1 + m__p))/36)*sin(x[7])*sin(x[6])*cos(x[8])^2 + (-27*(x[17] - g__1)*x[13]*(L*x[12]*x[13]*sin(x[5])*m__1 - (4*sin(x[4])*(m__1 + m__p)*(x[17] - g__1))/27)*sin(x[6])*cos(x[7]) + 12*m__1*sin(x[7])*L*(x[12]^2*x[18] + 5/2*x[13]^2*x[18] - 1/6*x[20])*sin(x[8])*sin(x[6])*sin(x[5]) + x[15]*(x[17] - g__1)^2*(m__1 + m__p))*cos(x[8]) - 36*((2*x[18]*sin(x[8])*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/6)*cos(x[7]))/3 + (m__1*sin(x[4])*x[13]*L*((x[17] - g__1)*x[12]^2 + (x[17]/2 - g__1/2)*x[13]^2 - x[19]/6)*sin(x[5]) - (11*x[12]*(x[17] - g__1)^2*(m__1 + m__p))/36)*sin(x[7]))*sin(x[6]))*cos(x[6]) - 6*m__1*sin(x[5])*L*(x[12]^2*x[18] + 5/2*x[13]^2*x[18] - 1/6*x[20])*cos(x[8])^2 + 36*(m__1*sin(x[4])*x[13]*L*((x[17] - g__1)*x[12]^2 + (x[17]/2 - g__1/2)*x[13]^2 - x[19]/6)*sin(x[5]) - (11*x[12]*(x[17] - g__1)^2*(m__1 + m__p))/36)*sin(x[8])*cos(x[8]) + x[14]*sin(x[8])*(x[17] - g__1)^2*(m__1 + m__p)*cos(x[7]) + 6*m__1*(x[12]^2*x[18] + 3/2*x[13]^2*x[18] - 1/6*x[20])*L*sin(x[5]) + x[15]*sin(x[6])*sin(x[7])*sin(x[8])*(x[17] - g__1)^2*(m__1 + m__p))*cos(x[4])^3 + ((-6*(cos(x[7])^2 - 2)*(m__1*sin(x[4])*x[12]*((x[17] - g__1)*x[12]^2 + ((15*x[17])/2 - (15*g__1)/2)*x[13]^2 - x[19]/2)*L*sin(x[5]) - (11*x[13]*(x[17] - g__1)^2*(m__1 + m__p))/6)*cos(x[8])^2 + (-24*(L*x[12]*x[13]*sin(x[5])*m__1 - sin(x[4])*(m__1 + m__p)*(x[17] - g__1)/6)*x[18]*sin(x[8])*cos(x[7])^2 - 42*(x[17] - g__1)*(L*x[13]*m__1*(x[12]^2 - x[13]^2/7)*sin(x[5]) - (11*x[12]*sin(x[4])*(m__1 + m__p)*(x[17] - g__1))/42)*sin(x[7])*cos(x[7]) + 48*(L*x[12]*x[13]*sin(x[5])*m__1 - sin(x[4])*(m__1 + m__p)*(x[17] - g__1)/6)*x[18]*sin(x[8]))*cos(x[8]) + 9*(x[17] - g__1)*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 + 5*(m__1 + m__p)*(x[17] - g__1)/9)*x[13]*cos(x[7])^2 + 3*L*x[13]^2*x[18]*cos(x[7])*sin(x[4])*sin(x[5])*sin(x[7])*sin(x[8])*m__1 - 6*m__1*sin(x[4])*x[12]*((x[17] - g__1)*x[12]^2 + ((15*x[17])/2 - (15*g__1)/2)*x[13]^2 - x[19]/2)*L*sin(x[5]) + 11*x[13]*(x[17] - g__1)^2*(m__1 + m__p))*cos(x[6])^2 + (-48*(L*x[12]*x[13]*sin(x[5])*m__1 - sin(x[4])*(m__1 + m__p)*(x[17] - g__1)/6)*sin(x[7])*x[18]*sin(x[6])*cos(x[8])^2 + 12*(-L*x[13]^2*x[18]*cos(x[7])*sin(x[4])*sin(x[5])*m__1/4 + sin(x[7])*(m__1*sin(x[4])*x[12]*((x[17] - g__1)*x[12]^2 + ((15*x[17])/2 - (15*g__1)/2)*x[13]^2 - x[19]/2)*L*sin(x[5]) - (11*x[13]*(x[17] - g__1)^2*(m__1 + m__p))/6)*sin(x[8]))*sin(x[6])*cos(x[8]) - 42*(x[17] - g__1)*(L*x[13]*m__1*(x[12]^2 - x[13]^2/7)*sin(x[5]) - (11*x[12]*sin(x[4])*(m__1 + m__p)*(x[17] - g__1))/42)*sin(x[8])*sin(x[6])*cos(x[7]) + 24*m__1*(-x[13]*x[15]*sin(x[8])*(x[17] - g__1)*sin(x[4])/24 + x[12]*x[18]*sin(x[6])*sin(x[7]))*x[13]*L*sin(x[5]) - 4*x[18]*sin(x[4])*sin(x[6])*sin(x[7])*(m__1 + m__p)*(x[17] - g__1))*cos(x[6]) + (-6*m__1*sin(x[4])*x[12]*((x[17] - g__1)*x[12]^2 + ((15*x[17])/2 - (15*g__1)/2)*x[13]^2 - x[19]/2)*L*sin(x[5]) + 11*x[13]*(x[17] - g__1)^2*(m__1 + m__p))*cos(x[8])^2 + (L*x[13]^2*x[14]*sin(x[4])*sin(x[5])*m__1*(x[17] - g__1)*cos(x[7]) - 24*m__1*(-x[13]*x[15]*sin(x[6])*sin(x[7])*(x[17] - g__1)*sin(x[4])/24 + x[12]*x[18]*sin(x[8]))*x[13]*L*sin(x[5]) + 4*x[18]*sin(x[4])*sin(x[8])*(m__1 + m__p)*(x[17] - g__1))*cos(x[8]) + x[15]*sin(x[4])*sin(x[6])*(x[17] - g__1)^2*(m__1 + m__p)*cos(x[7]) + 6*m__1*sin(x[4])*((x[17] - g__1)*x[12]^2 + ((9*x[17])/2 - (9*g__1)/2)*x[13]^2 - x[19]/2)*x[12]*L*sin(x[5]) - 9*(x[17] - g__1)^2*(x[14]*sin(x[4])*sin(x[7])/9 + x[13])*(m__1 + m__p))*cos(x[4])^2 + ((6*L*sin(x[5])*m__1*x[12]^2*x[18]*(cos(x[7])^2 - 2)*cos(x[8])^2 - 36*(x[17] - g__1)*((L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - 2*(m__1 + m__p)*(x[17] - g__1)/9)*x[12]*sin(x[8])*cos(x[7])^2 - x[18]*sin(x[7])*(m__1 + m__p)*cos(x[7])/9 - 2*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - 2*(m__1 + m__p)*(x[17] - g__1)/9)*x[12]*sin(x[8]))*cos(x[8]) + 6*(x[17] - g__1)*x[13]*sin(x[7])*(L*x[12]*x[13]*sin(x[5])*m__1 - (7*sin(x[4])*(m__1 + m__p)*(x[17] - g__1))/6)*sin(x[8])*cos(x[7]) + 6*L*sin(x[5])*m__1*x[12]^2*x[18])*cos(x[6])^2 + (-72*(x[17] - g__1)*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - 2*(m__1 + m__p)*(x[17] - g__1)/9)*sin(x[7])*x[12]*sin(x[6])*cos(x[8])^2 + (-6*(x[17] - g__1)*x[13]*(L*x[12]*x[13]*sin(x[5])*m__1 - (7*sin(x[4])*(m__1 + m__p)*(x[17] - g__1))/6)*sin(x[6])*cos(x[7]) - 12*L*x[12]^2*x[18]*sin(x[5])*sin(x[6])*sin(x[7])*sin(x[8])*m__1 - x[15]*(x[17] - g__1)^2*(m__1 + m__p))*cos(x[8]) + 36*(x[17] - g__1)*(x[18]*sin(x[8])*(m__1 + m__p)*cos(x[7])/9 + (L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - 2*(m__1 + m__p)*(x[17] - g__1)/9)*sin(x[7])*x[12])*sin(x[6]))*cos(x[6]) + 6*L*sin(x[5])*cos(x[8])^2*m__1*x[12]^2*x[18] - 36*(x[17] - g__1)*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - 2*(m__1 + m__p)*(x[17] - g__1)/9)*x[12]*sin(x[8])*cos(x[8]) - x[14]*sin(x[8])*(x[17] - g__1)^2*(m__1 + m__p)*cos(x[7]) - 6*L*sin(x[5])*m__1*x[12]^2*x[18] - x[15]*sin(x[6])*sin(x[7])*sin(x[8])*(x[17] - g__1)^2*(m__1 + m__p))*cos(x[4]) + 6*(x[17] - g__1)*sin(x[4])*x[12]*((L*x[12]^2*sin(x[5])*m__1*(cos(x[7])^2 - 2)*cos(x[8])^2 + (7*cos(x[7])*sin(x[7])*(m__1 + m__p)*(x[17] - g__1)*cos(x[8]))/6 + L*x[12]^2*sin(x[5])*m__1)*cos(x[6])^2 - 2*(L*x[12]^2*cos(x[8])*sin(x[5])*sin(x[7])*m__1 - (7*cos(x[7])*(m__1 + m__p)*(x[17] - g__1))/12)*sin(x[8])*sin(x[6])*cos(x[6]) + L*x[12]^2*sin(x[5])*m__1*(cos(x[8]) - 1)*(cos(x[8]) + 1)))*cos(x[5])^3 + (6*(((cos(x[7])^2 - 2)*cos(x[8])^2 - 2*cos(x[7])^2 + 1)*cos(x[6])^2 - 2*cos(x[6])*sin(x[7])*cos(x[8])*sin(x[6])*sin(x[8]) + cos(x[8])^2)*(x[17] - g__1)*m__1*x[13]^3*L*cos(x[4])^5 + 36*m__1*x[13]^2*(((x[12]*sin(x[8])*(x[17] - g__1)*cos(x[7])^2 - x[18]*cos(x[7])*sin(x[7])/3 - 2*x[12]*sin(x[8])*(x[17] - g__1))*cos(x[8]) + x[13]*cos(x[7])*sin(x[4])*sin(x[7])*sin(x[8])*(x[17] - g__1)/3)*cos(x[6])^2 + 2*(x[12]*sin(x[7])*(x[17] - g__1)*cos(x[8])^2 - x[13]*sin(x[4])*cos(x[7])*(x[17] - g__1)*cos(x[8])/6 - x[18]*cos(x[7])*sin(x[8])/6 - x[12]*sin(x[7])*(x[17] - g__1)/2)*sin(x[6])*cos(x[6]) + x[12]*cos(x[8])*sin(x[8])*(x[17] - g__1))*L*cos(x[4])^4 - 18*x[13]*((m__1*((x[17] - g__1)*x[12]^2 + ((7*x[17])/6 - (7*g__1)/6)*x[13]^2 - x[19]/6)*(cos(x[7])^2 - 2)*L*cos(x[8])^2 + ((2*L*x[13]*x[18]*cos(x[7])^2*sin(x[4])*sin(x[8])*m__1)/3 + 2*(x[17] - g__1)*(-11*(m__1 + m__p)*(x[17] - g__1)*sin(x[5])/36 + L*x[12]*x[13]*sin(x[4])*m__1)*sin(x[7])*cos(x[7]) - (4*L*x[13]*x[18]*sin(x[4])*sin(x[8])*m__1)/3)*cos(x[8]) + m__1*(((x[17] - g__1)*x[13]^2*cos(x[7])^2)/6 + (x[17] - g__1)*x[12]^2 + ((7*x[17])/6 - (7*g__1)/6)*x[13]^2 - x[19]/6)*L)*cos(x[6])^2 - 2*(-(2*L*x[13]*x[18]*cos(x[8])^2*sin(x[4])*sin(x[7])*m__1)/3 + m__1*((x[17] - g__1)*x[12]^2 + ((7*x[17])/6 - (7*g__1)/6)*x[13]^2 - x[19]/6)*sin(x[7])*L*sin(x[8])*cos(x[8]) - (x[17] - g__1)*(-11*(m__1 + m__p)*(x[17] - g__1)*sin(x[5])/36 + L*x[12]*x[13]*sin(x[4])*m__1)*sin(x[8])*cos(x[7]) + L*x[13]*x[18]*sin(x[4])*sin(x[7])*m__1/3)*sin(x[6])*cos(x[6]) + (((x[17] - g__1)*x[12]^2 + ((7*x[17])/6 - (7*g__1)/6)*x[13]^2 - x[19]/6)*cos(x[8])^2 + (2*x[13]*x[18]*cos(x[8])*sin(x[4])*sin(x[8]))/3 + (g__1 - x[17])*x[12]^2 + (-(5*x[17])/6 + (5*g__1)/6)*x[13]^2 + x[19]/6)*m__1*L)*cos(x[4])^3 + ((12*(-((m__1 + m__p)*(x[17] - g__1)*sin(x[5]))/3 + L*x[12]*x[13]*sin(x[4])*m__1)*(cos(x[7])^2 - 2)*x[18]*cos(x[8])^2 - 36*x[13]*((x[17] - g__1)*sin(x[8])*(-(11*sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5]))/36 + L*x[12]*x[13]*m__1)*cos(x[7])^2 + L*x[13]*x[18]*cos(x[7])*sin(x[7])*m__1/12 - 2*(x[17] - g__1)*sin(x[8])*(-(11*sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5]))/36 + L*x[12]*x[13]*m__1))*cos(x[8]) - 4*x[18]*sin(x[5])*(m__1 + m__p)*(x[17] - g__1)*cos(x[7])^2 + 9*(x[17] - g__1)*(-(10*x[12]*(m__1 + m__p)*(x[17] - g__1)*sin(x[5]))/9 + L*x[13]^3*sin(x[4])*m__1)*sin(x[7])*sin(x[8])*cos(x[7]) + 12*(-((m__1 + m__p)*(x[17] - g__1)*sin(x[5]))/3 + L*x[12]*x[13]*sin(x[4])*m__1)*x[18])*cos(x[6])^2 + (-72*(x[17] - g__1)*x[13]*sin(x[7])*(-(11*sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5]))/36 + L*x[12]*x[13]*m__1)*sin(x[6])*cos(x[8])^2 + (-9*(x[17] - g__1)*(-(10*x[12]*(m__1 + m__p)*(x[17] - g__1)*sin(x[5]))/9 + L*x[13]^3*sin(x[4])*m__1)*sin(x[6])*cos(x[7]) + 8*x[18]*sin(x[6])*sin(x[7])*sin(x[8])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5]) - 24*m__1*(x[12]*x[18]*sin(x[4])*sin(x[6])*sin(x[7])*sin(x[8]) - x[13]*x[15]*(x[17] - g__1)/24)*x[13]*L)*cos(x[8]) + 36*(-L*x[13]*x[18]*cos(x[7])*sin(x[8])*m__1/12 + (x[17] - g__1)*sin(x[7])*(-(11*sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5]))/36 + L*x[12]*x[13]*m__1))*x[13]*sin(x[6]))*cos(x[6]) + 12*(-((m__1 + m__p)*(x[17] - g__1)*sin(x[5]))/3 + L*x[12]*x[13]*sin(x[4])*m__1)*x[18]*cos(x[8])^2 - 36*(x[17] - g__1)*x[13]*sin(x[8])*(-(11*sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5]))/36 + L*x[12]*x[13]*m__1)*cos(x[8]) + L*x[13]^2*x[14]*sin(x[8])*m__1*(x[17] - g__1)*cos(x[7]) + 4*x[18]*sin(x[5])*(m__1 + m__p)*(x[17] - g__1) - 12*m__1*x[13]*L*(x[12]*x[18]*sin(x[4]) - x[13]*x[15]*sin(x[6])*sin(x[7])*sin(x[8])*(x[17] - g__1)/12))*cos(x[4])^2 + 18*(x[17] - g__1)*(((cos(x[7])^2 - 2)*x[12]*(-sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5])/3 + L*x[12]*x[13]*m__1)*cos(x[8])^2 - ((-7*(m__1 + m__p)*(x[17] - g__1)*sin(x[5])/6 + L*x[12]*x[13]*sin(x[4])*m__1)*x[13]*sin(x[7])*cos(x[7])*cos(x[8]))/3 - (5*x[12]*sin(x[4])*sin(x[5])*(m__1 + m__p)*(x[17] - g__1)*cos(x[7])^2)/9 + (2*x[18]*sin(x[4])*sin(x[5])*sin(x[7])*sin(x[8])*(m__1 + m__p)*cos(x[7]))/9 + x[12]*(-sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5])/3 + L*x[12]*x[13]*m__1))*cos(x[6])^2 + (-2*(x[18]*sin(x[4])*sin(x[5])*(m__1 + m__p)*cos(x[7])/9 + sin(x[7])*x[12]*(-sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5])/3 + L*x[12]*x[13]*m__1)*sin(x[8]))*sin(x[6])*cos(x[8]) - (((-7*(m__1 + m__p)*(x[17] - g__1)*sin(x[5])/6 + L*x[12]*x[13]*sin(x[4])*m__1)*x[13]*sin(x[6])*cos(x[7]) + x[15]*sin(x[4])*sin(x[5])*(m__1 + m__p)*(x[17] - g__1)/6)*sin(x[8]))/3)*cos(x[6]) + x[12]*(-sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5])/3 + L*x[12]*x[13]*m__1)*cos(x[8])^2 + sin(x[4])*sin(x[5])*(m__1 + m__p)*(x[17] - g__1)*(sin(x[6])*sin(x[7])*x[15] + x[14]*cos(x[7]))*cos(x[8])/18 - x[12]*(-sin(x[4])*(m__1 + m__p)*(x[17] - g__1)*sin(x[5])/3 + L*x[12]*x[13]*m__1))*cos(x[4]) + 7*x[12]*cos(x[6])*cos(x[7])*sin(x[5])*(x[17] - g__1)^2*(m__1 + m__p)*(cos(x[6])*sin(x[7])*sin(x[8]) - sin(x[6])*cos(x[8])))*cos(x[5])^2 + (-12*L*x[13]^3*cos(x[6])*cos(x[7])*sin(x[5])*m__1*(cos(x[6])*sin(x[7])*cos(x[8]) + sin(x[6])*sin(x[8]))*(x[17] - g__1)*cos(x[4])^4 - 12*m__1*sin(x[5])*x[13]^2*(((-x[18]*cos(x[7])^2/2 + x[18])*cos(x[8])^2 + x[13]*sin(x[4])*sin(x[8])*(cos(x[7])^2 - 2)*(x[17] - g__1)*cos(x[8]) - x[18]/2)*cos(x[6])^2 + 2*(x[13]*sin(x[4])*(x[17] - g__1)*cos(x[8])^2 + x[18]*cos(x[8])*sin(x[8])/2 - x[13]*sin(x[4])*(x[17] - g__1)/2)*sin(x[7])*sin(x[6])*cos(x[6]) - x[18]*cos(x[8])^2/2 + x[13]*sin(x[4])*sin(x[8])*(x[17] - g__1)*cos(x[8]) + x[18]/2)*L*cos(x[4])^3 + 18*(x[17] - g__1)*x[13]*(((L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/3)*(cos(x[7])^2 - 2)*cos(x[8])^2 - L*x[13]^2*cos(x[7])*cos(x[8])*sin(x[5])*sin(x[7])*m__1/3 - 5*(m__1 + m__p)*(x[17] - g__1)*cos(x[7])^2/9 + L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/3)*cos(x[6])^2 - 2*sin(x[8])*((L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/3)*sin(x[7])*cos(x[8]) + L*x[13]^2*cos(x[7])*sin(x[5])*m__1/6)*sin(x[6])*cos(x[6]) + (cos(x[8]) + 1)*(L*x[12]*x[13]*sin(x[4])*sin(x[5])*m__1 - ((m__1 + m__p)*(x[17] - g__1))/3)*(cos(x[8]) - 1))*cos(x[4])^2 + 10*(x[17] - g__1)*(sin(x[7])*cos(x[7])*(-(2*x[18]*cos(x[8]))/5 + x[13]*sin(x[4])*sin(x[8])*(x[17] - g__1))*cos(x[6])^2 + (-(x[17] - g__1)*(x[13]*cos(x[7])*sin(x[4])*sin(x[6]) - x[15]/10)*cos(x[8]) - (2*x[18]*cos(x[7])*sin(x[6])*sin(x[8]))/5)*cos(x[6]) + sin(x[8])*(x[17] - g__1)*(sin(x[6])*sin(x[7])*x[15] + x[14]*cos(x[7]))/10)*(m__1 + m__p)*cos(x[4]) - 7*x[12]*cos(x[6])*cos(x[7])*sin(x[4])*(x[17] - g__1)^2*(m__1 + m__p)*(cos(x[6])*sin(x[7])*cos(x[8]) + sin(x[6])*sin(x[8])))*cos(x[5]) + 6*(x[17] - g__1)*cos(x[4])*x[13]*(((1 + (cos(x[7])^2 - 2)*cos(x[8])^2)*cos(x[6])^2 - 2*cos(x[6])*sin(x[7])*cos(x[8])*sin(x[6])*sin(x[8]) + cos(x[8])^2 - 1)*m__1*x[13]^2*L*cos(x[4])^2 - (7*cos(x[6])*cos(x[7])*sin(x[5])*(m__1 + m__p)*(cos(x[6])*sin(x[7])*cos(x[8]) + sin(x[6])*sin(x[8]))*(x[17] - g__1))/6))/(cos(x[4])^4*m__1*(((((cos(x[7])^2 - 2)*cos(x[8])^2 - 2*cos(x[7])^2 + 1)*cos(x[6])^2 - 2*cos(x[6])*sin(x[7])*cos(x[8])*sin(x[6])*sin(x[8]) + cos(x[8])^2)*cos(x[4])^2 + 2*cos(x[6])*cos(x[7])*sin(x[4])*(cos(x[6])*sin(x[7])*sin(x[8]) - sin(x[6])*cos(x[8]))*cos(x[4]) - 2*(cos(x[8])^2 - 1/2)*(cos(x[7])^2 - 2)*cos(x[6])^2 + 4*cos(x[6])*sin(x[7])*cos(x[8])*sin(x[6])*sin(x[8]) - 2*cos(x[8])^2 + 1)*cos(x[5])^2 - 2*sin(x[5])*(cos(x[6])*cos(x[7])*(cos(x[6])*sin(x[7])*cos(x[8]) + sin(x[6])*sin(x[8]))*cos(x[4]) + sin(x[4])*(cos(x[8])*sin(x[8])*(cos(x[7])^2 - 2)*cos(x[6])^2 + 2*(cos(x[8])^2 - 1/2)*sin(x[7])*sin(x[6])*cos(x[6]) + cos(x[8])*sin(x[8])))*cos(x[5]) + (1 + (cos(x[7])^2 - 2)*cos(x[8])^2)*cos(x[6])^2 - 2*cos(x[6])*sin(x[7])*cos(x[8])*sin(x[6])*sin(x[8]) + cos(x[8])^2 - 1)*L*cos(x[5])^4)

## When is the composition operator @ necessary?...

Here is an example where (f@g)(..) cannot be written f(g(..)): When is @ necessary?

```restart:
with(Statistics):
interface(displayprecision=4):
S := Sample(Uniform(-1, 1), 10):
((max-min)/Mean)(S);  # correctly evaluated

abs(Mean(S)); # correctly evaluated

((max-min)/abs(Mean))(S);  # unevaluated value: abs(Mean) appears as  |Statistics:-Mean|

((max-min)/(abs@Mean))(S);  # correctly evaluated

```

## Why do I receive "float(undefined)" for the deriva...

Hello,

I have defined a piecewise function, and then i derive that function and take the arctan of it. However for x=5, which is the maximum x value for the piecewise function, it shows "Float(undefined)".I have attached images at the bottom. I havent been able to figure out why this happens and i would appreciate any help. Also, does somebody know why the following error appears when i try to upload the .mw file?

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/crimp_versuch_tagentenstetig.mw .

## Why does 1e-(Digits) return 1.?...

Why does  1e-(Digits) return 1. and 1e-Digits generate an error?

```1e-Digits;
Error, missing operator or `;`

1e(-Digits);
1.
type(Digits, posint)
true
```

## The plot of a function goes wrong...

Hi

A function ta(x) is defined

Testing it indicates  that everything seems ok.

ta(2010);                 0.2212273448

ta(2050);               4.440420849

But printing goes totally wrong :

plot(ta(x), x = 2000 .. 2030);

The code consists of 13 constants and 4 equations.

Am I overlooking something?  Any idea?

```na := 8.069439677916595*10^5;
nb := -1.777065899098942*10^3;
nc := 1.467451715287991;
nd := -5.383733471268420*10^(-4);
ne := 7.404613067985871*10^(-8);
am := 0.77317633747818500000;
bm := -0.00626025741156560000;
cm := 0.00002185947833342660;
ap := 471.909671218139000000000000;
bp := -7.368938071612570000000000;
cp := 0.041111235018593800000000;
dp := -0.000098963929768727000000;
ep := 0.88147417256725300*10^(-7);

c_y := y -> na + nb*y + nc*y^2 + nd*y^3 + ne*y^4;
to_c := ppm -> ap + bp*ppm + cp*ppm^2 + dp*ppm^3 + ep*ppm^4;
to_y := y -> tpn(c_y(y));
ta := x -> 0.0014*int(to_y(y), y = 2000 .. x);
```

## select and structured types. How to make select st...

Ok, I think I am starting to get the hang of this. So in Maple, structured types is like a pattern in Mathematica. To find some subexpression one needs to first define a structured type which match that subexpression, and then use  select(type,.....).

This works well so far (but it is not as easy as setting up a pattern).

But one small problem is that select() starts looking at the operands of the expression to look for a match.

So if the whole expression itself matches the structured type, it will not detect the whole expression, since select goes over each operand, missing that the whole thing actually matches the type.

May be an example helps shows what I mean. I want to find if an expression has cos(anything)*sin(anything) so I made a structured type for this

`mytype_3 :=  ''`*`'( {'specfunc'(cos),'specfunc'(sin)})';`

btw, I do not know if I should use `&*` or '`*`' but that is a side point, I'll try to find this out.

Now I want to use the above to check if expression has the same "structured type", or "pattern". The expression is expr:=cos(x)*sin(x); clearly it matches it. But since select looks at the operands, it will only see cos(x) by itself, and then sin(x) by itself and hence not find the structured type.

```restart;
mytype_3 :=  ''`*`'( {'specfunc'(cos),'specfunc'(sin)})';
expr:=cos(x)*sin(x);
type(expr,mytype_3);  # true
select(type, expr, mytype_3); # does not work, does not find it.
```

Since I am doing this in code, and I do not know what the expression is, I think I have to now do the following

```restart;
mytype_3 :=  ''`*`'( {'specfunc'(cos),'specfunc'(sin)})';
expr:=cos(x)*sin(x);
if type(expr,mytype_3) then
print("The whole expression is a match! nothing to do. no need to use select");
else
select(type, expr, mytype_3);
fi;
```

Which is OK. I can do this, But it will be nice if there was a way to have select (or another function like it) starts at the top level before looking at the operands?

How do others handle such cases? does the above sound like an OK solution to this?

## Help to obtain solution...

Hi

I am a research scholar in mathematics

I am currently working on fluid mechanics

I wish to obtain the solution given in the research article

In the paper they mentioned that " Shooting method" is used.

Please anyone help me regarding this topic

File : 1.pdf

Thank you

## how to make type selection orderless? ...

I am learning how to use select with my own types defined, to find parts of expression. This is instead of using patmach.

For example, given   3+x^2*sin(x) and then I want to find any POLYNIMAL*sin function, if present. So I did the following

```restart;
expr_1:=3+x^2*sin(x):
mytype_1 := `&*`( polynom(And(algebraic, satisfies(u -> not has(u, I))),x),specfunc('sin')):
select( z->type(z,mytype_1),expr_1);
```

Which works. Maple returned

The problem is that if I change the order of multiplication, and also at same time change the polynomial by adding one more term, it no longer works!

I have no idea why. It seems Maple rememebrs something.  Here is a screen shot, followed by plain text code.

code

```restart;
expr_1:=3+(1+x)*sin(x):
mytype_1 := `&*`( polynom(And(algebraic, satisfies(u -> not has(u, I))),x),specfunc('sin')):
select( z->type(z,mytype_1),expr_1);
expr_1:=3+sin(x)*(1+x):
select( z->type(z,mytype_1),expr_1);

#change polynomial but keep same order, it works
expr_2:=3+(1+x+x^2)*sin(x):
select( z->type(z,mytype_1),expr_2);

#change order BUT keep same polynomial, it works
expr_3:=3+sin(x)*(1+x+x^2):
select(z->type(z, mytype_1),expr_3);

#keep same order as above, but change polynomial, now it does not works
expr_4:=3+sin(x)*(1+x+x^2+x^4):
select(z->type(z, mytype_1),expr_4);

#keep same order as first one  but change polynomial, it does not work
expr_5:=3+(1+x+x^2+x^4)*sin(x):
select(z->type(z, mytype_1),expr_5);

#keep same order as first one but change polynomial back to what it was, now it works
expr_6:=3+(1+x)*sin(x):
select(z->type(z, mytype_1),expr_6);

```

What Am I doing wrong?

Maple 2021.1

## How to extract from an expression the terms of a g...

Hi,

I have  an expression made of a sum of different terms from which I want to extract all terms of a specific form.

A typical expression and the functions I want to extract is given in the attached file.

You will see in the example that the terms in the expression can be

• a constant
• a continuous function of t
• a piecewise function like
```something*piecewise(a(t) < 0, A(t), a(t) < 1, B(t), ...)
```
• a piecewise function like
`something*piecewise(t < 0, A(t), t < 1, B(t), ...)`

The functions I want to extract are only those of this latter form .

MyExpr.mw

PS: all the situations I have to manage contain expressions of the form of the prototype expression given in the attached file.
Nothing more general than this.

## Can an ellipsoid be internally tangent to any tetr...

This worksheet displays an ellipsoid internally tangent to the four sides of a tetrahedron.

The tetrahedron is a special case: it has a horizontal base with vertices A,B and C and its fourth vertex E is on the z axis.

However I have failed when trying to display an internally tangent ellipsoid in any other tetrahedron.

Will any tetrahedron support one or more internally tangent ellipsoids?

If so, are there conditions restricting the location of the mutual points of tangency?

Ellipsoid_in_a_tetrahedron.mw

## Dual branch solution to ode...

How to obtain a dual branch solution in Maple.

Is there any specific method is there to get these type of solutions.

I have attached the document.

Thank you.

## maple code iteration newton...

I'm trying to construct an iterative procedure al1(f,x0) where f is a function, x0 is an initial estimate.

Now for example by defining f:= x-> 4*x^4-4*x^2 and inputting x0=0.75 and N=10 i should be able to check that my procedure calculates 1 correctly.

f := x -> 4*x^4 - 4*x^2;
f1 := D(f);
f2 := D(f1);
x0 := 0.75;
Digits := 100;
tol := 10.^(-15);

al1:= proc(f,x0)
local y, z, s, i, fs, a, de;
s := x0:
a[0]:=x0;
for i from 1 to 10
while abs(fs)>tol and de>tol do
y := evalf(s- f(s)/f1(s)):
s:=evalf(y-f(y)/f1(y)):
fs:=evalf(f(s)):
a[i]:=s:
de:=abs(evalf(a[i]-a[i-1])):
end do:
return n, s, fs, de;
end proc;

> n, s, fs, de := al1(f, 0.75);
Error, (in al1) cannot determine if this expression is true or false: 0.1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-14 < abs(fs) and 0.1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-14 < de

The code i've written so far is incorrect but i'm not sure where i'm going wrong. Would you be able to give me some pointers?

## Bug in the combine command ...

Hi !

Sorry but there is a bug in the "combine" command when combining double summations.
Maple 2017,2018 and 2020 all give me a wrong answer. I have an old version of Maple which gives the correct answer.
I have put an example in the attached file.

bugcombine.mw

Best regards
Réjean