# [Maxima] how to simplify this equation

Stavros Macrakis macrakis at alum.mit.edu
Wed Dec 29 10:10:17 CST 2010

```Razif,

There are many possible simplifications for expressions like this.

To take a simpler case, which is the "simplest" form:

1) sin(a)*cos(a)*sin(b)
2) sin(2*a)*sin(b)/2
3) (cos(b-2*a) - cos(b+2*a))/4

I suspect that each of these forms is best in a different situation.

There are a couple of things you ought to do before trying to simplify your
expression:

1) There is apparently a typo, where you write sin*(b) -- I assume this
should be sin(b).
2) The Maxima convention is that 0.5 is an approximate number
(floating-point) and 1/2 is an exact number.  As it happens, trigsimp treats
0.5 as equivalent to 1/2, but other parts of Maxima do not.  So it is best
to use 1/2 systematically.
3) I see that you use the variable 'i' once in your expression -- is that
correct?  or should it be %i?

After you do that, I recommend you try various combinations of trigsimp,
trigreduce, trigexpand, factor, factorsum, facsum, etc.

Assuming i should be %i, the best I could do was:

expr:    /* corrected expression */

1/2*(1/2*(1+n)*cos(a)*cos(b)*sin(a)*sin(b)/(1+n)+1/2*(1+n)^2*(cos(a))^2*(sin(a))^2)

+(1/2*%i/sqrt(1+n))

*(-(1/2*%i*n/sqrt(1+n))*(cos(a))^2*(cos(b))^2-(1/2*%i*n*(1+n)/sqrt(1+n))*(cos(a))^2*(sin(b))^2)

+(1/2/(1+n))

*(((1/2*(cos(a))^2*(cos(b))^2+1/2*(cos(b))^2*(sin(b))^2+1/2*n^2*(cos(a))^2*(sin(b))^2+1/2*n*(sin(a))^2*(sin(b))^2)/(1+n))+1/2*(1+n)*cos(a)*cos(b)*sin(a)*sin(b))

-(1/2*%i/sqrt(1+n))

*(1/2*%i*n*sqrt(1+n)*(cos(a))^2*(sin(b))^2+(1/2*%i*n/sqrt(1+n))*(sin(a))^2*(sin(b))^2)
;

texpr: trigsimp(expr);

facsum(texpr,[operator(sin),operator(cos)]);     /* collect terms */

which gives

-(cos(a)^4*(n+1)^4-2*cos(a)*sin(a)*cos(b)*sin(b)*(n+1)^2-cos(a)^2*(n^4+6*n^3+10*n^2+4*n+1)+cos(b)^2*(n^2+2*n-1)+cos(a)^2*cos(b)^2*(2*n+1)*(n^2+n-1)-n*(n+2)+cos(b)^4)/(4*(n+1)^2)

This can do doubt be massaged further.

-s

On Wed, Dec 29, 2010 at 01:06, razif razali <razif66 at gmail.com> wrote:

>
> 0.5*(0.5*(1+n)*cos(a)*cos(b)*sin(a)*sin(b)/(1+n)+0.5*(1+n)^2*(cos(a))^2*(sin(a))^2)+(0.5*%i/sqrt(1+n))*(-(0.5*%i*n/sqrt(1+n))*(cos(a))^2*(cos(b))^2-(0.5*i*n*(1+n)/sqrt(1+n))*(cos(a))^2*(sin(b))^2)+(0.5/(1+n))*(((0.5*(cos(a))^2*(cos(b))^2+0.5*(cos(b))^2*(sin(b))^2+0.5*n^2*(cos(a))^2*(sin(b))^2+0.5*n*(sin(a))^2*(sin(b))^2)/(1+n))+0.5*(1+n)*cos(a)*cos(b)*sin(a)*sin(b))-(0.5*%i/sqrt(1+n))*(0.5*%i*n*sqrt(1+n)*(cos(a))^2*(sin(b))^2+(0.5*%i*n/sqrt(1+n))*(sin(a))^2*(sin*(b))^2)
>
> i got this equation and try to simplify it in maxima
>
> i try used trigsimp command but still couldnt get simplest equation that i
> want
>
> hope someone can help me into this. i think the trick should be
> trigonometry identity but then when i used trigsimp the equation still not
> simplify using trigonometri identity
>
> thanks for looking into this
>
> --
> Regards,
>
> RAZIF RAZALI,
> Tutor & Master Student,
> Physics Department,
> Faculty Of Science,
> Universiti Teknologi Malaysia(UTM).
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20101229/466cf293/attachment.html>
```