Power function: Simplification of 0^a



I think the simplification of 0^a is not implemented as complete as
possible. This might be a complete definition:

 (1)  0^a -> 0 for realpart(a) > 0
 (2)  0^a -> infinity for realpart(a) < 0
 (3)  0^a -> und for realpart(a) = 0

For a number all is correct. Case (1) gives zero and the cases (2) and
(3) give a Maxima error.

But for a symbol or a symbolic expression we always get zero as a
result. We assume a to be a positive real value.

(%i1) declare(z,complex,j,imaginary)$
(%i2) assume(a>0)$

(%i3) 0^a;
(%o3) 0

(%i4) 0^-a; /* This expression is known to be negative */
(%o4) 0

Furthermore, Maxima does not look at the realpart of the exponent. The
following should simplify to zero:

(%i5) 0^(a+%i); /* The symbol %i generates an error */
0 to a complex quantity has been generated.
 -- an error. To debug this try: debugmode(true);

(%i6) 0^(a+j); /* A symbol declared to be imaginary gives no error */
(%o6) 0

(%i8) 0^-(a+j); /* Not correct */
(%o8) 0

(%i9) 0^-(a+z); /* Not correct */
(%o9) 0


I think the code in simpexpt.lisp which handles the above cases has to
look more carefully at the sign of the expression.

There is a problem if Maxima can not deduce the sign. We have three
options: 

 (1) Go on with the assumptions that the expression is positive.
     Now, Maxima does this for all symbolic expressions. Maxima might
give
     incorrect answers.
 (2) Generate a Maxima Error if the sign is not known.
     Maxima gives only correct answers.
 (3) Stop and ask the User for the sign.
     I think it is very uncomfortable to stop the execution.

I have tried an implementation for the case (2). These are the results:

(%i1) declare(j,imaginary,z,complex)$
(%i2) assume(a>0)$

The sign of x is not known. A Maxima error:

(%i3) 0^x;
0^(x) has been generated. The sign of x is not known.
 -- an error. To debug this try: debugmode(true);

Now a positive sign:

(%i4) 0^a;
(%o4) 0

An error if the exponent is negative:

(%i5) 0^-a;
Division by 0
 -- an error. To debug this try: debugmode(true);

The realpart is positive. Again zero as a result:

(%i6) 0^(a+%i*y);
(%o6) 0

A negative realpart gives a Maxima error:

(%i7) 0^(-a+%i*y);
0 to a complex quantity has been generated.
 -- an error. To debug this try: debugmode(true);

The example with a positive number as realpart:

(%i8) 0^(2+%i*y);
(%o8) 0

This is an example which is generated by the code of the confluent
hypergeomtric function:

(%i5) hgfred([x], [], 1);
0^(- x) has been generated. The sign of - x is not known.
 -- an error. To debug this try: debugmode(true);

a is assumed to be positive:

(%i6) hgfred([a], [], 1);
Division by 0
 -- an error. To debug this try: debugmode(true);

(%i7) hgfred([-a], [], 1);
(%o7) 0

The testsuite will generate only three errors. It is interesting that
these errors are related to the sqrt function.

Dieter Kaiser