Problems with the Gamma function



I have done some further numerical tests to find the limits of the Maxima Gamma
function for integer values.

CLISP 2.46

gamma(n) for big integers:

~ 101000 : the last value Maxima can evaluate and print
~ 102000 : Program stack overflow, the session is killed
~ 140000 : Lisp Error: Overflow in multiplication of big integers 
           (a rough translation from German: 
            ?berlauf bei Multiplikation langer Zahlen)

When we prevent printing the number e.g. gamma(134000)$ the biggest integer is
~134000. A bigger value gives an Lisp overflow error.

GCL 2.6.8

~ 111000 : the last value Maxima can evaluate and print
~ 112000 : random chars, the session hangs and has to been killed

Without printing the last integer is about ~1800000. For bigger values the
Maxima session is killed on my system.

The point is that for values greater than about 100,000 the result is
unpredictable. The Maxima session can be killed or the system hangs. On my
Windows system I can even produce a total system crash.

Because, the calculation for an integer is done by simpfact we could restrict
the calculation for big integers by setting $factlim as a default to 100,000.

We have the same problem with $gammalim and the calculation of values for a half
integral integer. I have not tested the limits, but a value of 100,000 for
$gammalim will work for this case too.

Perhaps we should test in simpgamma against $factlim and not $gammalim before we
call simpfact for a calculation. In this case $gammalim is only an upper limit
for an evaluation of half integral values and can be choosen more independent
from $factlim.

The problem with big integers is not very important for practical use, but I
don't like software which kills a session or a even reboot my system. In more
lengthy calculations with complicated expressions such errors may be difficult
to find.

Dieter Kaiser