For 0^x, Maxima does bother to check the sign of x, but 0^pnz simplifies to 0:
(%i2) 0^x;
1" Enter "csign[x]
1" Exit "csign pnz
(%o2) 0
Also, it's amusing to insert a bit of code into simpexpt to monitor for a^b with csign(a) = zero.
Due to the Persistence of (csign) Memory, the testsuite reports some errors, some are maybe OK, others not:
OK:
Running tests in rtest15:
********************** Problem 10 ***************
Input:
integrate(sqrt(k*t)/t^(3/2),t)
Result:
sqrt(k)*log(t)
This differed from the expected result:
(sqrt(k*t)*log(t))/sqrt(t)
These are likely bugs:
********************** Problem 142 ***************
Input:
specint((%e^(-s*t)*(unit_step(t)-unit_step(t-2*k)))/sqrt(t*(2*k-t)),t)
Result:
-sqrt(%pi)*%i*hypergeometric_u(1/2,1,-2*k*s)
This differed from the expected result:
sqrt(%pi)*%i*hypergeometric_u(1/2,1,2*k*s)*%e^(-2*k*s)-sqrt(%pi)*%i*hypergeometric_u(1/2,1,-2*k*s)
Running tests in rtest_equal:
********************** Problem 31 ***************
Input:
is(equal(%i,%i+x))
Result:
false
This differed from the expected result:
unknown
Running tests in rtest_abs:
********************** Problem 80 ***************
Input:
abs((-1)^x)
Result:
-(-1)^x
This differed from the expected result:
1
All I did was insert a (if (eq '$zero ($csign gr)) clause:
(defmfun simpexpt (x y z)
(prog (gr pot check res rulesw w mlpgr mlppot)
(setq check x)
(cond (z (setq gr (cadr x) pot (caddr x)) (go cont)))
(twoargcheck x)
(setq gr (simplifya (cadr x) nil))
(setq pot
(let (($%enumer $numer))
;; Switch $%enumer on, when $numer is TRUE to allow
;; simplification of $%e to its numerical value.
(simplifya (if $ratsimpexpons ($ratsimp (caddr x)) (caddr x))
nil)))
(if (eq '$zero ($csign gr))
(progn
(print "-----------------")
(displa `((mlist) ,gr ,pot))))
......
The function $csign has side-effects (alters fact database)--inserting $csign into code for a simplifying function isn't
risk free. Maybe a call to clearsign is needed in these cases, maybe not. The simpext function has many calls
to csign and about 23 go statements :(
The testsuite doesn't simplify 0^x all that often--I'd guess we could change the way 0^x simplifies without making a huge
mess of the testsuite.
Finally, simpquot is responsible for the difference between 1/0^x and 0^-x.
--Barton