Proposed bug fix for Bug 505443



Perhaps

sin(x/2) = signum(sin(x/2)) * sqrt(1-cos(x)) / sqrt(2),

where signum(x) =

  1 when x is in the right half-plane or on the positive imaginary axis,
  0 when x = 0,
 -1 when x is in the left half-plane or on the negative imaginary axis.

[Taking the branch cut of sqrt to be the negative real axis, for x # 0,
we have signum(x) = sqrt(x^2) / x.]

However, Maxima's signum function doesn't "know" anything about numbers
off the real axis;  I don't think a function should be fixed-up on
the negative real axis only to mess it up everywhere off the real axis.

Actually, I think Maxima's halfangle option variable is a bad idea;
whether the rule is applied or not depends on too many things: consider

(C1) display2d : false$
(C2) halfangles : true$
(C3) sin(1+x/2);
(D3) SIN(x/2+1)
(C4) rat(d3);
(D4) SIN(x/2+1)
(C5) ratsimp(d3);
(D5) SQRT(1-COS(x+2))/SQRT(2)
(C6) sin(x/sqrt(2));
(D6) SIN(x/SQRT(2))
(C7) ratsimp(d6);
(D7) SIN(x/SQRT(2))
(C8) ratsimp(d6),algebraic : true;
(D8) SQRT(2)*SQRT(1-COS(SQRT(2)*x))/2


Transformations similar to the half-angle formulae are best handled by
the user using let and letsimp; that leaves it  to the user to decide if
behavior off the real axis or branch
cuts will be a problem.

Barton