Subject: proposal for object-oriented dispatch on sign
From: Barton Willis
Date: Tue, 21 Jun 2011 16:33:49 -0500
I added a few lines to sign to support subscripted functions. Sadly, Maxima is
too eager to determine the sign using a (potentially bogus) floating point evaluation.
Examples:
Even with signbfloat false, sign uses floating point :(
(%i1) signbfloat : false$
(%i2) sign(li[2](7/8));
0> Calling (SIGN 1.2381234817964804)
<0 SIGN returned NIL
(%o2) pos
The sign function works by modifying special variables. This makes sign extra
fun to debug or understand.
For noninteger order Li, sign doesn't always use floating point :)
(%i3) sign(li[7/3](7/8));
0> Calling (SIGN ((MQAPPLY SIMP) (($LI SIMP ARRAY) ((RAT SIMP) 7 3)) ((RAT SIMP) 7 8)))
1> Calling (SIGN ((RAT SIMP) 7 8))
<1 SIGN returned NIL
1> Calling (SIGN ((RAT SIMP) 1 8))
<1 SIGN returned NIL
1> Calling (SIGN ((RAT SIMP) 7 8))
<1 SIGN returned NIL
<0 SIGN returned NIL
(%o3) pos
These should be pos, but due to floating point evaluation, sign returns pnz:
(%i4) sign(li[2](10^-1000));
(%o4) pnz
(%i5) sign(li[2](1/10^10000));
(%o5) pnz
Either completely stuck or takes longer than I'm willing to wait
(%i6) sign(li[2](1/10^10000000));
--Barton