Max Alekseyev on Wed, 26 Oct 2022 20:56:25 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: binomial coefficient with negative args


I worry that this extension is not consistent with the definition of binomial(n,k) as the coefficient of x^k in (1+x)^n.
According to this definition it should be zero for k < 0.
I'd vote for the discussed extension being made optional and turned off by default.

Regards,
Max

On Sun, Oct 23, 2022 at 9:33 AM Karim Belabas <Karim.Belabas@math.u-bordeaux.fr> wrote:
* Christian Krause [2022-10-22 21:46]:
> Hi,
> the binomial coefficient in GP behaves differently than I thought for
> negative arguments. For instance, binomial(-2,-4) yields 0 (zero). In
> Wolfram Alpha the result is 3. The paper by Kronenburg
> <https://arxiv.org/pdf/1105.3689.pdf> states this:
>
> [image: image.png]
>
> For binomial(-2,-4), the second case applies: (-1)^(-2+4) *
> binomial(4-1,-2+4) = binomial(3,2) = 3. This is consistent with Wolfram
> Alpha. They also document the same definition here
> <https://mathworld.wolfram.com/BinomialCoefficient.html>.
>
> Why does PARI/GP yield different results for binomial() with negative
> arguments?

The extension binomial(x, k) for negative n and k was not implemented.
Just did this in the 'master' branch following Kronenburg's extension,
updating the documentation in the process.

Please test !

Cheers,

    K.B.
--
Karim Belabas, IMB (UMR 5251), Université de Bordeaux
Vice-président en charge du Numérique
T: (+33) 05 40 00 29 77; http://www.math.u-bordeaux.fr/~kbelabas/
`