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. It may also be counterproductive to compute n! for very large n, simply because it may take more time and space than is available. 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. If your audience does not know about gamma functions, you can leave the factorials around. What if your audience doesn't know about factorials? RJF On Jun 15, 4:03 pm, Tom Coates <t.coa...@imperial.ac.uk> wrote: > > My vote is to have factorial(n) = n(n-1)...2.1 whenever n is integer. > > > Cheers, > > > Florent > > We certainly need to allow for symbolic input too, so that Sage can > simplify expressions involving factorials and binomial coefficients > such as: > > sage: var('k,n') > (k, n) > sage: f = factorial(k)*factorial(n-k)*binomial(n,k); f > factorial(-k + n)*factorial(k)*binomial(n, k) > sage: f.full_simplify() > factorial(n) > > My vote would be to allow symbolic input and to set factorial(n) = > n(n-1)...2.1 whenever n is a non-negative integer, but for > factorial(x) to raise an error whenever the expression x is numerical > but not equal to a non-negative integer. > > In this case full_simplify() should not turn expressions involving > factorial() into expressions involving gamma(), or vice versa. > > This might be contrary to the philosophy behind the symbolics module, > though. Let me know what you think. > > 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