Overall, I think the proposed change makes sense in the long run, and
Peter presents a good case. But there are some dangers.

Foremost, Clemens argues that a change will potentially brake user code:
while this is true, I think it should be overruled for the long
benefits, if another behaviour is mathematically preferable. Note also
that the proposed change *only* differs from current behaviour when
*both* n and k are negative (and |n| <= |k|); I think that the most
common out-of-ordinary-bounds call on binomial coefficients has k
negative while n positive (*).

As Nils Bruin points out on #17123, agreement with Maxima is also a
concern. But Nils Bruin's own test demonstrates that Sage currently
*doesn't* agree to Maxima. Maxima seems to use a strange mix between
Knuth's definition and the one proposed in #17123: it seems to match
#17123 except on binomial(n, n) for negative n, where it is zero while
#17123 dictates 1. binomial(n, n), n<0 is a case explicitly discussed in
Concrete Mathematics, so that might be why Maxima does this?

Volker Braun argued to add an optional argument `extension` to allow
choosing which behaviour to use. This covers all bases but leaves the
question as to which default to choose.

I vote for having #17123 as the default *in the long run*. If so, what
to do in the short run to mitigate user problems. We could
1) Return the value of #17123 but print a deprecation warning on input
   with conflicting behaviour. The warning tells the user to explicitly
   set the optional argument if he wants to disable the warning. Warning
   is removed in ~1 year.
2) Return the current value, but print a deprecation warning on input
   with conflicting behaviour. After one year, change the behaviour with
   no more deprecation warnings.

Best,
Johan

(*): Admittedly, that might be a total bogus impression.



Peter Luschny writes:

>  > Sage seems to use the definition from Concrete Mathematics by Graham,
>> Knuth and Patashnik:
>> That gives e.g.
>>  sage: binomial(-4, 5)
>>  -56
>
> Right. GKP call it "upper negation". If you look at my demo-function
> you will see that this condition is preserved in the suggested extension
> (case 3). The proposal returns a superset of the current values.
>
>> Concrete Mathematics is seen as something
>> of a bible in large parts of computer science, and it's unfortunate to
>> disagree with a basic definition in there.
>
> It /extends/ this definition. As long as k>=0 nothing will change
> compared to the GKP definition. Upper negation will be untouched.
>
> Peter


-- 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to