persistent way sign works



The bug https://sourceforge.net/tracker/index.php?func=detail&aid=3515955&group_id=4933&atid=104933 is due to a bug in sign:

  (%i6) e : ((sqrt(abs(sin(x)))-cos(atan2(0,sin(x))/2)*sqrt(sin(x)))/(sqrt(sin(x))*sqrt(abs(sin(x)))))$

Maxima says sign(e) is zero:

  (%i7) sign(e);
 (%o7) zero

but, for example,  e doesn't vanish at 4:

 (%i8) subst(x=4,e);
 (%o8) 1/sqrt(sin(4))

I think e vanishes when sin(x) > 0.  This bug may be due to the (crazy?) persistent way sign works.
Compare

 (%i9) map('sign, [sqrt(x),x]);
 (%o9) [pz,pz]

to 

 (%i10) map('sign, [x, sqrt(x)]);
 (%o10) [pnz,pz]

Expanding e allows Maxima to conclude that sign(e) is pnz

  (%i24) sign(expand(e));
  (%o24) pnz

Don't panic: I'm not suggesting that a fix for this bug is to insert calls to expand.

--Barton