bug in 1/(u!) function, maple 7 (7.3.02)

Adam Millican-Slater

This message supercedes previous message with a much more complicated function.

On maple 7 after defining the function; c:=(u)->evalf(1/(u!)); with Digits:=40; I have managed to get two different answers when evaluating this function at u=4999.

If I define m:=10000 and n:=9999 and then evaluate, first c(m/2) then c((n-1)/2) I get the same answer.

If I then evaluate c(m/2) and c((n-1)/2) again I get results which are again equal, but different from the intial result. This can be repeated to obtain further different results.

This problem can be avoided by evaluating c(evalf(m/2)) and c(evalf((n-1)/2)).

This problem does not seem to exist in Maple 6.

It is corrected with Maple 8 (U. Klein)

Stephen Forrest (8.3.02)

Yes, there’s a known problem with factorials in Maple 7 that has nothing to do with evalf or Digits; I think your problem is a manifestation of this. The bug was reported on comp.soft-sys.math.maple a while back, and you can see with this example from Maple 7:


versus, in Maple 6 and previous, the correct


Dr Francis J. Wright (11.3.02)

Here are a few general comments that might be relevant.

If I remember correctly, n! behaves asymptotically something like n^n, so 1000! has about 3000 digits and you are likely to see different numerical errors in you use different floating-point approximations with less than about 3000 significant digits.

If you use a floating-point operand with ! then presumably Maple evaluates it as a gamma function (since factorial proper is defined only for non-negative integers) and so runs completely different code.

The factorial implementation in Maple 7 is much more sophisticated than that in Maple 6, one consequence of which is that Factorial is used as a function name in Maple 7 and so is protected, which breaks (trivially) an example in my book!