From: Wesley Ooms on
Dear people,

the expression

m1*(-sin(q0)*(-cos(q2)*d1-cos(q6)*d4)+cos(q0)*sin(q1)*(sin(q2)*d1+sin(q6)*d4))^2+m1*(cos(q0)*(-cos(q2)*d1-cos(q6)*d4)+sin(q0)*sin(q1)*(sin(q2)*d1+sin(q6)*d4))^2

can be simplified to

(-cos(q2)*d1-cos(q6)*d4)^2+sin(q1)^2*(sin(q2)*d1+sin(q6)*d4)^2;

(m1, q0,q1,q2... are all symbolic variables)

However, the simple, or horner, or collect or simplify or factor routine cannot find the simpler expression.
I have almost a dozen of these expressions (121 to be exact). I found matlab could not simplify the expression, so i simplified them all manually. But I'd like to use a matlab routine since that is more reliable, and can be upscaled.
the problem seems to be that matlab doesn't see sin(q0)^2+cos(q0)^2=1.
Also, in the collect routine, I can force matlab to collect for example sin(q0)^2, but not sin(q0)^2+cos(q0)^2, and it doesn't seem to work either.

can anyone please help me

Thanks very much,

Wesley
From: Walter Roberson on
Wesley Ooms wrote:
> Dear people,
>
> the expression
>
> m1*(-sin(q0)*(-cos(q2)*d1-cos(q6)*d4)+cos(q0)*sin(q1)*(sin(q2)*d1+sin(q6)*d4))^2+m1*(cos(q0)*(-cos(q2)*d1-cos(q6)*d4)+sin(q0)*sin(q1)*(sin(q2)*d1+sin(q6)*d4))^2
>
>
> can be simplified to
>
> (-cos(q2)*d1-cos(q6)*d4)^2+sin(q1)^2*(sin(q2)*d1+sin(q6)*d4)^2;

Please recheck your result. Your simplified expression does not contain m1.
From: Wesley Ooms on
Walter Roberson <roberson(a)hushmail.com> wrote in message <jaC3o.2186$F%7.1107(a)newsfe10.iad>...
> Wesley Ooms wrote:
> > Dear people,
> >
> > the expression
> >
> > m1*(-sin(q0)*(-cos(q2)*d1-cos(q6)*d4)+cos(q0)*sin(q1)*(sin(q2)*d1+sin(q6)*d4))^2+m1*(cos(q0)*(-cos(q2)*d1-cos(q6)*d4)+sin(q0)*sin(q1)*(sin(q2)*d1+sin(q6)*d4))^2
> >
> >
> > can be simplified to
> >
> > (-cos(q2)*d1-cos(q6)*d4)^2+sin(q1)^2*(sin(q2)*d1+sin(q6)*d4)^2;
>
> Please recheck your result. Your simplified expression does not contain m1.

Oh, I'm sorry. I forgot to premultiply with m1, so I ment that it can be simplified to

m1*((-cos(q2)*d1-cos(q6)*d4)^2+sin(q1)^2*(sin(q2)*d1+sin(q6)*d4)^2).

but matlab still won't find the simplified version
From: Walter Roberson on
Wesley Ooms wrote:
> Walter Roberson <roberson(a)hushmail.com> wrote in message
> <jaC3o.2186$F%7.1107(a)newsfe10.iad>...
>> Wesley Ooms wrote:
>> > Dear people,
>> > > the expression
>> > >
>> m1*(-sin(q0)*(-cos(q2)*d1-cos(q6)*d4)+cos(q0)*sin(q1)*(sin(q2)*d1+sin(q6)*d4))^2+m1*(cos(q0)*(-cos(q2)*d1-cos(q6)*d4)+sin(q0)*sin(q1)*(sin(q2)*d1+sin(q6)*d4))^2
>> > > > can be simplified to
>> > > (-cos(q2)*d1-cos(q6)*d4)^2+sin(q1)^2*(sin(q2)*d1+sin(q6)*d4)^2;
>>
>> Please recheck your result. Your simplified expression does not
>> contain m1.
>
> Oh, I'm sorry. I forgot to premultiply with m1, so I ment that it can be
> simplified to
> m1*((-cos(q2)*d1-cos(q6)*d4)^2+sin(q1)^2*(sin(q2)*d1+sin(q6)*d4)^2).
> but matlab still won't find the simplified version


Maple 13 has trouble finding the simplification as well. I do not have
my copy of Maple 14 installed anywhere so I cannot test with that.