## #863 sign bug

closed
5
2009-03-15
2006-01-30
No

(%i14) 1-sqrt(1-x);
(%o14) 1-sqrt(1-x)
(%i15) x * diff(%,x)/%;
(%o15) x/(2*(1-sqrt(1-x))*sqrt(1-x))
(%i16) abs(%);

Yeechs! numerator is x.

(%o16) x/(2*abs(sqrt(1-x)-1)*sqrt(1-x))
Let's check the sign at -0.1
(%i17) subst(x=-0.1,%);
(%o17) -0.97673129462279451

Try again using cabs; this looks OK:

(%i18) 1-sqrt(1-x);
(%o18) 1-sqrt(1-x)
(%i19) x * diff(%,x)/%;
(%o19) x/(2*(1-sqrt(1-x))*sqrt(1-x))
(%i20) cabs(%);
Is x - 1 positive, negative, or zero? neg;
(%o20) abs(x)/abs(2*x+2*sqrt(1-x)-2)

Let's try again -- this time I'll trace sign

(%i23) x * diff(%,x)/%;
(%o23) x/(2*(1-sqrt(1-x))*sqrt(1-x))
(%i24) abs(%);
1 Enter sign [x/(2*(1-sqrt(1-x))*sqrt(1-x))]
1 Exit sign pn
1 Enter sign [1/(1-sqrt(1-x))]
1 Exit sign pn
1 Enter sign [1-sqrt(1-x)]
1 Exit sign pn
1 Enter sign [1/sqrt(1-x)]
1 Exit sign pos
1 Enter sign [x]
1 Exit sign pos <--- bogus

(%i30) build_info();
Maxima version: 5.9.2.19cvs
Maxima build date: 10:34 1/27/2006
host type: i686-pc-mingw32
lisp-implementation-type: GNU Common Lisp (GCL)
lisp-implementation-version: GCL 2.6.7

Barton

## Discussion

• Robert Dodier - 2006-08-15

Logged In: YES
user_id=501686

Observed in 5.9.3.99rc1 / Clisp 2.38.

• Robert Dodier - 2006-08-15
• labels: --> Lisp Core - Assume

• Dan Gildea - 2009-03-15

Fixed in compar.lisp rev 1.46.

(%i1) 1-sqrt(1-x);
(%o1) 1-sqrt(1-x)

(%i2) x * diff(%,x)/%;
(%o2) x/(2*(1-sqrt(1-x))*sqrt(1-x))

(%i3) abs(%);
(%o3) abs(x)/(2*abs(sqrt(1-x)-1)*sqrt(1-x))

• Dan Gildea - 2009-03-15
• status: open --> closed
• assigned_to: nobody --> dgildea