#17123: Extending binomial(n,k) to negative integers n, k.
---------------------------------+------------------------
Reporter: pluschny | Owner:
Type: enhancement | Status: new
Priority: minor | Milestone: sage-6.4
Component: combinatorics | Resolution:
Keywords: binomial | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
---------------------------------+------------------------
Comment (by pluschny):
Ralf, a quick numerical check did not show any difference:
{{{
for n in (-4..4):
print "plu", [n], [BINOMIAL (-n , -k) for k in (-6..6)]
print "rws", [n], [BINOMIALrws(-n , -k) for k in (-6..6)]
}}}
So please give one counterexample (n,k) where the definitions differ.
But I do prefer my form over your form. I write
{{{
if n >= 0 and k >= 0:
return binomial(n, k)
}}}
and this makes it perfectly clear that in this region nothing
changes, that all changes apply only to negative integers.
I think this lowers the burden of understanding the code.
Darij: "... your convention is not standard in any way."
(1) If it were standard it would be pointless to call
it an 'extension'.
(2) As an extension it is standard for more than a quarter
of a century due to the fact that both Maple and Mathematica
use this extension ever since the beginning.
(3) So even if you prefer not to use this extension in
your papers using Sage will give you different results
than many of your colleagues will get with different software.
And indeed this was for me the motivation to write this
ticket: I found the confusion annoying which shows up in
many places in the code on OEIS because the systems behave
differently and that this fact is often overlooked. Nobody
expects this to happen with a standard function like 'binomial'.
Therefore I would even prefer a "value error" (or what
it is called) for arguments not in the range 0<=k<=n
for integer k, n, over the current behaviour of Sage.
Darij: "I don't know why people are saying that it is
currently undefined."
This is the difference between a formal "... otherwise 0"
and a definition guided by mathematical considerations
which aims to enlarge relations to the largest possible
region of validity. (Instead accepting things like
binomial(z, z) != 1 as a collateral damage.)
--
Ticket URL: <http://trac.sagemath.org/ticket/17123#comment:17>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.