Incomplete Gamma fails for negative integer arguments



The numerical algorithm of gamma_incomplete(n,z) do not work for an argument n=0
or n a negative integer where realpart(z)<0.

The reason is that for these cases the series expansion for the numerically
evaluation does not work. Maxima gets a term in the expansion with a division by
zero.

I do not know why I have omitted to test these values.

Here are the results:

(%i18) gamma_incomplete(0,0.5);
Maxima encountered a Lisp error:

 Error in PROGN [or a callee]: Zero divisor.

Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.

n negative integer, but z positive. This works, because Maxima uses an expansion
in continued fractions.

(%i19) gamma_incomplete(-1,0.5);
(%o19) 0.65328772464911

n negative integer and z<0. Error. The series expansion fails. (Remark: An
expansion in continued fractions would fail too. It does not converge.)

(%i20) gamma_incomplete(-1,-0.5);
Maxima encountered a Lisp error:

 Error in PROGN [or a callee]: Zero divisor.

Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.

(%i21) gamma_incomplete(-2,-0.5);
Maxima encountered a Lisp error:

 Error in PROGN [or a callee]: Zero divisor.

Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.

Two possible ways to solve the problem:

1. Improve the series expansion for the special cases.
   Might not be possible.
2. Using expintegral_e(n,z) for these special values.

I am working on the problem.

Dieter Kaiser