[sage-devel] Re: factorial() and gamma()

2010-06-17 Thread rjf
The distinction that may be worth making is that there are (at least) two notions of factorial. One that is subject to symbolic simplification and one that is a numerical subroutine. There may be yet more. The simplification version allows for factorial(n+1)/factorial(n) ---> n+1 and does not r

Re: [sage-devel] Re: factorial() and gamma()

2010-06-17 Thread Florent Hivert
Hi there, > > In Sage, the behavior of sqrt(2) versus sqrt(4) is considered very > > reasonable > > to most users.  And it does exactly what you claim is "rather bad form". > > > > sage: sqrt(2) > > sqrt(2) > > sage: sqrt(4) > > 2 > > sage: type(sqrt(2)) > > > > sage: type(sqrt(4)) > > >

[sage-devel] Re: factorial() and gamma()

2010-06-17 Thread Nils Bruin
On Jun 17, 12:51 pm, William Stein wrote: > In Sage, the behavior of sqrt(2) versus sqrt(4) is considered very reasonable > to most users.  And it does exactly what you claim is "rather bad form". > > sage: sqrt(2) > sqrt(2) > sage: sqrt(4) > 2 > sage: type(sqrt(2)) > > sage: type(sqrt(4)) > Th

Re: [sage-devel] Re: factorial() and gamma()

2010-06-17 Thread William Stein
On Thu, Jun 17, 2010 at 12:14 PM, Nils Bruin wrote: > On Jun 17, 10:32 am, Robert Dodier wrote: >> On Jun 16, 11:24 am, Tom Coates wrote: >> >> > A)  factorial(x) should raise an error; >> >> > B)  factorial(x) should return gamma(x+1). >> >> More generally, the question is what to do with somet

[sage-devel] Re: factorial() and gamma()

2010-06-17 Thread Nils Bruin
On Jun 17, 10:32 am, Robert Dodier wrote: > On Jun 16, 11:24 am, Tom Coates wrote: > > > A)  factorial(x) should raise an error; > > > B)  factorial(x) should return gamma(x+1). > > More generally, the question is what to do with something > which doesn't make sense according to whatever rules ha

[sage-devel] Re: factorial() and gamma()

2010-06-17 Thread Robert Dodier
On Jun 16, 11:24 am, Tom Coates wrote: > A)  factorial(x) should raise an error; > > B)  factorial(x) should return gamma(x+1). More generally, the question is what to do with something which doesn't make sense according to whatever rules have been established so far. I claim the "mathematical"

[sage-devel] Re: factorial() and gamma()

2010-06-17 Thread rjf
On Jun 17, 3:07 am, David Kirkby wrote: ... > BTW, the #6 hit for factorial in Google, and the number 1 hit for > factorial calculator is this > > http://www.cs.uml.edu/~ytran/factorial.html > > One might have hoped a professor of computer science could have done a > bit better. 1. It appears

[sage-devel] Re: factorial() and gamma()

2010-06-17 Thread rjf
It is my recollection that the definition of sqrt of a negative number, say -9, in the unix math library is the sqrt of abs value. Hence it returns 3. So that's another choice. Contrary to Tom's note, I am not requiring that the range and domain of a function be the same, though it may have appea

Re: [sage-devel] Re: factorial() and gamma()

2010-06-17 Thread David Kirkby
On 16 June 2010 15:48, rjf wrote: > > > On Jun 15, 9:28 pm, Tom Coates wrote: > > By your reasoning, and for other domains we would have the following > behavior: > sqrt(-1) -->  error.  after all, some Sage users may not have > encountered imaginary numbers. > RJF That's a very weak argument.

Re: [sage-devel] Re: factorial() and gamma()

2010-06-16 Thread Dan Drake
On Wed, 16 Jun 2010 at 01:58PM -0400, Jason Bandlow wrote: > > At the moment there does not seem to be a clear consensus either way. > > If you have an opinion on this, please vote! Let x be an explicit > > numerical value such that x is not a non-negative integer (e.g. x=2/3, > > x=1.5, or x=i).

Re: [sage-devel] Re: factorial() and gamma()

2010-06-16 Thread David Kirkby
On 16 June 2010 18:24, Tom Coates wrote: > At the moment there does not seem to be a clear consensus either way. > If you have an opinion on this, please vote!  Let x be an explicit > numerical value such that x is not a non-negative integer (e.g. x=2/3, > x=1.5, or x=i).  The options are: > > A)

Re: [sage-devel] Re: factorial() and gamma()

2010-06-16 Thread Peter Jeremy
On 2010-Jun-16 10:24:35 -0700, Tom Coates wrote: >That said, if the consensus is that factorial(x) should be >analytically continued, to allow x to be an explicit non-integral >number (as is the case in Maple and Mathematica), then I am happy with >this. But then we should change the documentatio

[sage-devel] Re: factorial() and gamma()

2010-06-16 Thread Jason Bandlow
> At the moment there does not seem to be a clear consensus either way. > If you have an opinion on this, please vote! Let x be an explicit > numerical value such that x is not a non-negative integer (e.g. x=2/3, > x=1.5, or x=i). The options are: > > A) factorial(x) should raise an error; > >

Re: [sage-devel] Re: factorial() and gamma()

2010-06-16 Thread Robert Miller
> At the moment there does not seem to be a clear consensus either way. > If you have an opinion on this, please vote!  Let x be an explicit > numerical value such that x is not a non-negative integer (e.g. x=2/3, > x=1.5, or x=i).  The options are: > > A)  factorial(x) should raise an error; > > B

[sage-devel] Re: factorial() and gamma()

2010-06-16 Thread Tom Coates
On 16 June, 07:48, rjf wrote: > 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..  

[sage-devel] Re: factorial() and gamma()

2010-06-16 Thread rjf
On Jun 15, 9:28 pm, Tom Coates 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