Question: Simplification of trigonometric expression. IV

Hello,

I have still some difficulties to conduct some specific trigonometric simplications but which are very common in mechanism study.

The equations are in the form :

sin(gamma0(t))*cos(beta0(t)) = -(sin(psi[1](t))*cos(theta[1](t))*cos(gamma[1](t))+sin(psi[1](t))*sin(theta[1](t))*sin(gamma[1](t))-cos(theta[1](t))*cos(psi[1](t))*sin(gamma[1](t))+cos(psi[1](t))*sin(theta[1](t))*cos(gamma[1](t)))*cos(beta[1](t))

I would like to obtain this equation after simplifications :

sin(gamma0(t))*cos(beta0(t)) = cos(beta[1](t))*sin(gamma[1](t)-theta[1](t)-psi[1](t))

I try to make a procedure to automatize the simplification of this kind of trigonometric equation.

Strangely, I noticed that the simplification is done only if there is a minus before the combine function. The simplification works but the result is wrong because i didn't obtain the good sign.

For you information, I try to make these simplifications with MMA and the FullSimplify function of MMA gives directly the expected result that is to say :

I'm sure that it shoud exist a good way to conduct this kind of simplications in Maple.

Can you help me to correct my procedure so to obtain the good result and be enough general, adaptative ? 

Code here and attached in this post :

Initialisation
restart:
with(LinearAlgebra):
with(Student[MultivariateCalculus]):
with(plots):
with(MathML):
with(ListTools):
constants:= ({constants} minus {gamma})[]:
`evalf/gamma`:= proc() end proc:
`evalf/constant/gamma`:= proc() end proc:
unprotect(gamma);
Angular Constraint equations
eq_liaison:=sin(gamma0(t))*cos(beta0(t)) = -(sin(gamma[1](t))*sin(psi[1](t))*sin(theta[1](t))-sin(gamma[1](t))*cos(theta[1](t))*cos(psi[1](t))+cos(gamma[1](t))*sin(psi[1](t))*cos(theta[1](t))+cos(gamma[1](t))*cos(psi[1](t))*sin(theta[1](t)))*cos(beta[1](t)); 
Traitement
TrigoTransform2:= proc(Eq)
local S,S1,tt,pp,Eq2,ListVariables,ListVariablesMod,Subs,size,rhsEq2,lhsEq2;
#Construit une liste à plat#
ListVariables:=indets(Eq, function(identical(t)));
ListVariables:=[op(ListVariables)];
ListVariablesMod:=map(f->cat(op(0,f),_),ListVariables);
Subs:=ListVariables=~ListVariablesMod;
#Variables Changement#
Eq2:=Eq:
print("Equation traitée=",Eq2): 
Eq2:=subs(Subs, Eq2);
print("Equation après subs=",Eq2): 
#Trigonometric transformations#
lhsEq2:=applyrule([
cos(u::anything)*cos(v::anything)-sin(u::anything)*sin(v::anything)=cos(u+v), 
cos(u::anything)*sin (v::anything)+sin(u::anything)*cos(v::anything)=sin(u+v), 
sin(u::anything)*sin(v::anything)-cos(u::anything)*cos(v::anything)=-cos(u+v), 
-sin(v::anything)*cos(u::anything)-sin(u::anything)*cos(v::anything)=-sin(u+v)], simplify(lhs(Eq2), size));
print("Equation lhsEq2 première analyse=",lhsEq2):
rhsEq2:=applyrule([
cos(u::anything)*cos(v::anything)-sin(u::anything)*sin(v::anything)=cos(u+v), 
cos(u::anything)*sin (v::anything)+sin(u::anything)*cos(v::anything)=sin(u+v), 
sin(u::anything)*sin(v::anything)-cos(u::anything)*cos(v::anything)=-cos(u+v), 
-sin(v::anything)*cos(u::anything)-sin(u::anything)*cos(v::anything)=-sin(u+v)], simplify(rhs(Eq2), size));
print("Equation rhsEq2 première analyse=",rhsEq2):
try
lhsEq2:=(trigsubs(2*combine(lhsEq2))[])/2;
print("Equation lhsEq2=",lhsEq2):
catch:
lhsEq2:=lhs(Eq2);
end try;
try
rhsEq2:=(trigsubs(-2*combine(rhsEq2))[])/2;
print("Equation rhsEq2=",rhsEq2):
catch:
rhsEq2:=rhs(Eq2);
end try;
Eq2:= lhsEq2=rhsEq2;
#Variables Changement#
Eq2:=subs(map(t->rhs(t)=lhs(t),Subs),Eq2) 
end proc:
TrigoTransform2(eq_liaison);

TrigoTransformEqAng2_anglais.mws

Thanks a lot for your help.

Please Wait...