As ddrake pointed out in Trac #9248, even when x is in the symbolic ring, factorial(x) is not simply calling gamma(x+1):
sage: x=I; factorial(x) 0.498015668118356 - 0.154949828301811*I sage: gamma(x+1) gamma(I + 1) So something strange is going on. I think that the first example here is probably a bug. I am happy to fix whatever is wrong, but we need to decide what the correct behaviour should be. On 15 June, 17:02, rjf <fate...@gmail.com> wrote: > factorial(n+1)/factorial(n) is generally believed to be n+1. > It is proper treatment of matters like this that make simplification > interesting. > > It is fairly pointless to raise an error for factorial for any number > except possibly explicit negative integers. I have not thought seriously about the issues involved, so my opinion should be regarded as tentative. But right now my view is that the symbolic expressions factorial(x) and gamma(x+1) should not be identified, and that factorial(x) should raise an error for explicit numerical values of x other than 0, 1, 2, ... . This is for the following reason. factorial(n) is an object from concrete mathematics (the number of arrangements of n objects; here n is a natural number) whereas the gamma function is not in any sense an elementary object. So factorial(x) should not be identified with gamma(x+1), because the domains of the two functions x \mapsto factorial(x) x \mapsto gamma(x+1) are different. Since the domain of x \mapsto factorial(x) is the natural numbers, factorial(x) should raise an error for explicit numerical values of x other than 0,1,2,3,... The symbolic expression factorial(n+1)/factorial(n) should still be equal to n+1, because the expression n could be a natural number. As I said, though, this might be contrary to the philosophy behind the symbolics module. Please let me know what you think. > And by the way, if you do decide to provide an explicit numeric > integer, there are much better ways of computing n! than > multiplying n by n-1 by .... . > for largish n. I agree. But my understanding is that Sage computes n! (where n is an explicit non-negative integer) in an intelligent way. Best, Tom -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org