[Fwd: Re: [Maxima] Proposed bug fix for Bug 505443]



-------- Original Message --------
Subject: Re: [Maxima] Proposed bug fix for Bug 505443
Date: Thu, 27 Jun 2002 11:22:07 -0700 (PDT)
From: "R. William Gosper" <rwg at spnet>
To: fateman@cs.berkeley.edu

 >
 > (C1) halfangles:true;
 >
 > (D1)                               TRUE
 > (C2) sin(x/2);
 >
 >                              SQRT(1 - COS(x))
 > (D2)                         ----------------
 >                                  SQRT(2)
 >
 >
 > This is clearly wrong when X is negative.

Only sometimes.

 > One possible solution is for maxima to return
 >
 >                         SQRT(1 - COS(x)) SIGNUM(x)
 > (D3)                    --------------------------
 >                                  SQRT(2)
 >
 > which is correct.

No.

(c92) (sin(x/2),%% = halfangles(%%));

                           x    sqrt(1 - cos(x))
(d92)                 sin(-) = ----------------
                           2        sqrt(2)

(c93) %*(1 = signum(x));

                      x    sqrt(1 - cos(x)) signum(x)
(d93)            sin(-) = --------------------------
                      2             sqrt(2)

(c94) subst(-3*%pi,x,[d92,d93]);

(d94)                      [1 = 1, 1 = - 1]

I suspect the only correct expression involves an awkward NUMMOD, as in

(c105) block([return_nummod : true],asin(sin(x)));

                  %pi   |           %pi              |
(d105)           --- - |nummod(x + ---, 2 %pi) - %pi|
                   2    |            2               |

which nobody seems to want, even though

(c106) sin(%);

(d106)                          sin(x)

Maybe I'll but a return_nummod check in halfangles.
--rwg