challenge for trigsimp



trigrat and poissimp both work well in this case, however both of them blow
up for cases which they're not designed for.  For example:

     poissimp(sin(x+1)) => Illegal arg

poissimp is even sensitive to variable *names*:

     poissimp(sin(a)) => Illegal arg

Trigrat tends to return huge, ugly values for expressions it is not designed
for, often with big unsimplified subexpressions:

(%i26) trigrat(sqrt(sin(x)));
Is  sin(x)*sin(2*x)+cos(x)*cos(2*x)-cos(x)  positive, negative, or zero?

p;
(%o26)
-(%i*sqrt(sqrt((sin(x)^2+cos(x)^2)*sin(2*x)^2+(sin(x)^2+cos(x)^2)*cos(2*x)^2+(-2*sin(x)^2-2*cos(x)^2)*cos(2*x)+sin(x)^2+cos(x)^2)
                  -cos(x)*sin(2*x)+sin(x)*cos(2*x)-sin(x))

-sqrt(sqrt((sin(x)^2+cos(x)^2)*sin(2*x)^2+(sin(x)^2+cos(x)^2)*cos(2*x)^2+(-2*sin(x)^2-2*cos(x)^2)*cos(2*x)+sin(x)^2+cos(x)^2)
               +cos(x)*sin(2*x)-sin(x)*cos(2*x)+sin(x)))
        /2
(%i27) trigsimp(%);
(%o27)
(sqrt(cos(x)*sin(2*x)-sin(x)*cos(2*x)+sqrt(2-2*cos(2*x))+sin(x))-%i*sqrt(-cos(x)*sin(2*x)+sin(x)*cos(2*x)+sqrt(2-2*cos(2*x))-sin(x)))/2
(%i28) trigreduce(%);
(%o28)
(sqrt(sqrt(2-2*cos(2*x))+2*sin(x))-%i*sqrt(sqrt(2-2*cos(2*x))-2*sin(x)))/2


So neither of them is really robust and general-purpose the way trigsimp,
trigexpand, and trigreduce are.

              -s


On Tue, Sep 29, 2009 at 1:24 PM, Edwin Woollett <woollett at charter.net>wrote:

> On Sept. 28, Richard Fateman wrote:
> ----------------------------------------
> cos(y+2*x)+2*sin(x)*sin(y+x)-cos(y)
>
> trigsimp(%)   ;; no change
>
> trigreduce(%)  ;; changed
>
> ratsimp(%)     ;; produces zero.
>
> poissimp  produces zero right away.
> -----------------------------------------------
> If a multiple term trig function expression should
> equal zero, I like trigrat.
> ---------------------------------
> (%i1) e : cos(y+2*x)+2*sin(x)*sin(y+x)-cos(y)$
> (%i2) poissimp (e);
> (%o2)                                  0
> (%i3) trigrat (e);
> (%o3)                                  0
> (%i4) trigreduce (e), ratsimp;
> (%o4)                                  0
> (%i5) ( ev(trigexpand (e),trigexpand,expand),trigsimp(%%));
> (%o5)                                  0
> ---------------------
>
> Ted Woollett
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>