On Jun 15, 9:28 pm, Tom Coates <t.coa...@imperial.ac.uk> wrote: > ...
> > 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 > .... By your reasoning, and for other domains we would have the following behavior: 1-2 --> error. 1 and 2 are both positive integers. In order to provide the answer -1, one must expand the domain to include negative integers. 1 / 2 --> error.. (integers vs. rationals). Indeed there are some systems (Axiom) that warn about such things. sqrt(-1) --> error. after all, some Sage users may not have encountered imaginary numbers. Now these 3 items are not entirely silly. You might want to do them. But probably you want to provide an "analytic continuation" of discrete functions when possible. (Why might you want to do sqrt(-1) --> error? ... Say you are writing in FORTRAN and have an array of single-float numbers, A. If you do A(3)=sqrt(x) and x happens to be -1.0, what do you do? ) David K's note regarding what is done in other CAS may provide guidance. However, I will point out once again that the problem in simplifying factorial() is trivial compared to simplifying combinations of them. From a programming standpoint, you are looking at strictly local transformations -- replacing a tree node by another based solely on that node's descendants. The tough ones require examining the node's neighbors, perhaps at some great distance. RJF -- 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