# [Maxima] common factor reduction

Marco Frigerio marco.frigerio at iit.it
Wed Jan 25 09:36:05 CST 2012

```Thank you.
But look at this:

(%i92) foo;
(%o92)            0.35 sin(q1) cos(q2) - 0.35 cos(q1) sin(q2)
(%i93) ratsimp(trigreduce(foo));

rat: replaced 0.35 by 7/20 = 0.35
rat: replaced -0.35 by -7/20 = -0.35
7 sin(q2 - q1)
(%o93)                         - --------------
20

There is still an awful denominator there (yes I know I could use float
to get rid of it. But sometimes I would also need an additional 'expand')

The point is why I cannot simply have the common factor to be written
once (sorry I'm not sure how to say this in english..)

0.35 ( sin(q1) cos(q2) - cos(q1) sin(q2))

which is really independent of the fact that I have trigonometric functions.
'factor' somehow does that, but it introduces denominators as well:

(%i125) factor(foo);

rat: replaced 0.35 by 7/20 = 0.35
rat: replaced -0.35 by -7/20 = -0.35
7 (cos(q1) sin(q2) - sin(q1) cos(q2))
(%o125)             - -------------------------------------
20

Can I maybe avoid that 'rat' replaces 0.35?

thanks again
M

On 01/25/2012 11:46 AM, Alexander Klimov wrote:
> On Tue, 24 Jan 2012, Marco Frigerio wrote:
>> (%i..) trigreduce( -4*cos(q1)*sin(q2)  +  4*sin(q1)*cos(q2) );
>>
>>             sin(q2 + q1)   sin(q2 - q1)       sin(q2 + q1)   sin(q2 - q1)
>> (%o..) 4 (------------ - ------------) - 4 (------------ + ------------)
>>                  2              2                  2              2
>>
>> I would really like to see
>>      - sin(q2 - q1) 4
>>
>> How can I achieve this?
>
>   %,ratsimp;
>

```