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

2010-06-17 Thread David Kirkby
On 16 June 2010 15:48, rjf fate...@gmail.com wrote: On Jun 15, 9:28 pm, Tom Coates t.coa...@imperial.ac.uk 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.

[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

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

2010-06-17 Thread rjf
On Jun 17, 3:07 am, David Kirkby david.kir...@onetel.net 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

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

2010-06-17 Thread Robert Dodier
On Jun 16, 11:24 am, Tom Coates t.coa...@imperial.ac.uk 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

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

2010-06-17 Thread Nils Bruin
On Jun 17, 10:32 am, Robert Dodier robert.dod...@gmail.com wrote: On Jun 16, 11:24 am, Tom Coates t.coa...@imperial.ac.uk 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

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

2010-06-17 Thread William Stein
On Thu, Jun 17, 2010 at 12:14 PM, Nils Bruin nbr...@sfu.ca wrote: On Jun 17, 10:32 am, Robert Dodier robert.dod...@gmail.com wrote: On Jun 16, 11:24 am, Tom Coates t.coa...@imperial.ac.uk wrote: A)  factorial(x) should raise an error; B)  factorial(x) should return gamma(x+1). More

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

2010-06-17 Thread Nils Bruin
On Jun 17, 12:51 pm, William Stein wst...@gmail.com 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)) type

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)) type 'sage.symbolic.expression.Expression' sage:

[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

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

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

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 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; B)

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

2010-06-16 Thread Peter Jeremy
On 2010-Jun-16 10:24:35 -0700, Tom Coates t.coa...@imperial.ac.uk 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