Am Sonntag, den 17.01.2010, 16:33 -0500 schrieb Stavros Macrakis:
> On Sun, Jan 17, 2010 at 3:10 PM, Dieter Kaiser <drdieterkaiser at web.de>
> wrote:
> > evaluation of the power function is not implemented as
> complete as might
> > be necessary.
>
>
> The power function should be just a thin convenience veneer on top of
> the simplifier. All the real work should be happening in simpexpt.
>
> Or perhaps you are just using 'the power function' as a shorthand for
> "the simplification of a^b"?
Yes, I have used the name power function for the operator "^", that is
z^a.
Perhaps it is useful to have a function "power" like "sqrt" and "exp"
too. The implementation would only support the name. The work is done in
simpexpt.
By the way: This could be the code to improve the handling of 0^a in
simpexpt. This code returns a noun form 0^x if the sign of x is not
known.
((zerop1 gr)
(cond ((or (member (setq z ($csign pot)) '($neg $nz))
(and *zexptsimp? (eq ($asksign pot) '$neg)))
;; A negative exponent. Maxima error.
(cond ((not errorsw) (merror "Division by 0"))
(t (throw 'errorsw t))))
((and (member z '($complex $imaginary))
;; A complex exponent. Look at the sign of the realpart.
(not (member (setq z ($sign ($realpart pot)))
'($pos $pz))))
(cond ((not errorsw)
(merror "0 to a complex quantity has been generated."))
(t (throw 'errorsw t))))
((and *zexptsimp? (eq ($asksign pot) '$zero))
(cond ((not errorsw) (merror "0^0 has been generated"))
(t (throw 'errorsw t))))
((not (member z '($pos $pz)))
;; The sign of realpart(pot) is not know.
(cond ((not errorsw)
(return (list '(mexpt simp) 0 pot)))
(t (throw 'errorsw t))))
(t (return (zerores gr pot)))))
I have tested the code again. There are no problems with the testsuite
and the share_testsuite.
Dieter Kaiser