This site is supported by donations to The OEIS Foundation.

User:Peter Luschny/ExtensionsOfTheBinomial

Blaise Pascal, Traité du triangle arithmétique (Cambridge University Library, Licensed under (CC BY-NC 3.0))

Extensions of the Binomial

The basic conditions

The binomial is a function $\mathbb {Z} \ \times \ \mathbb {Z} \ \rightarrow \ \mathbb {Z}$ ( $\mathbb {Z}$ is the set of all integers) based on a quotient of factorials

def b(n, k): return factorial(n) / (factorial(k) * factorial(n-k))

and ruled by three conditions which describe the nonzero values of this function:

•  the Pascal condition,
•  the Riordan condition (a.k.a. reflection),
•  the Taylor condition (a.k.a. upper negation).
def binomial(n, k):
if 0 <= k <= n: return b(n, k)                         # Pascal
if k <= n <  0: return b(-k - 1, n - k) * (-1)^(n - k) # Riordan
if n <  0 <= k: return b(-n + k - 1, k) * (-1)^k       # Taylor
return 0
 1 0 0 0 -3 1 0 0 3 -2 1 0 -1 1 -1 1
 -4 -3 -2 -1
 1 -4 10 -20 1 -3 6 -10 1 -2 3 -4 1 -1 1 -1
 -4 -3 -2 -1

 0 1 2 3
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 1 2 3
 1 0 0 0 1 1 0 0 1 2 1 0 1 3 3 1

Alternatively the binomial function can be defined as the limit of the quotient of Gamma values:

def limit_binomial(n, k):
return limit(gamma(n + x) / (gamma(k + x)*gamma(n - k + x)), x = 1)

for n in (-5..5): print [limit_binomial(n, k) for k in (-5..5)]

Both definitions yield the same result. This proves that the three conditions form a coherent unit and are anything but an arbitrary collection of formulas.

There is also a basic representation of the binomial function defined with the Pascal and the Riordan condition but without the Taylor condition in terms of the matrix exponential: it is the matrix exponential of the matrix which has ..., -3, -2, -1, 0, 1, 2, 3, ... as subdiagonal and zero everywhere else.

matrix(SR,11,[
0,0,0,0,0,0,0,0,0,0,0,
-4,0,0,0,0,0,0,0,0,0,0,
0,-3,0,0,0,0,0,0,0,0,0,
0,0,-2,0,0,0,0,0,0,0,0,
0,0,0,-1,0,0,0,0,0,0,0,
0,0,0,0, 0,0,0,0,0,0,0,
0,0,0,0,0, 1,0,0,0,0,0,
0,0,0,0,0,0, 2,0,0,0,0,
0,0,0,0,0,0,0, 3,0,0,0,
0,0,0,0,0,0,0,0, 4,0,0,
0,0,0,0,0,0,0,0,0, 5,0
]).exp()
[ 1  0  0  0  0  0  0  0  0  0  0]
[-4  1  0  0  0  0  0  0  0  0  0]
[ 6 -3  1  0  0  0  0  0  0  0  0]
[-4  3 -2  1  0  0  0  0  0  0  0]
[ 1 -1  1 -1  1  0  0  0  0  0  0]
[ 0  0  0  0  0  1  0  0  0  0  0]
[ 0  0  0  0  0  1  1  0  0  0  0]
[ 0  0  0  0  0  1  2  1  0  0  0]
[ 0  0  0  0  0  1  3  3  1  0  0]
[ 0  0  0  0  0  1  4  6  4  1  0]
[ 0  0  0  0  0  1  5 10 10  5  1]

In some sense this shows that the Riordan condition is more fundamental than the Taylor condition as it reveals a fundamental reflection principle (or duality) of the binomial function similar to the reflections of the Stirling numbers {n,k} = [-k,-n] or of the Lah numbers |n,k| = |-k,-n| whereas the Taylor condition mainly is a convenience relation suggested by Taylor's theorem from calculus.

Maple's and Mathematica's binomial functions behave like the binomial defined here. It is a sad fact that SageMath has only implemented a crippled form of the binomial function without the Riordan condition. (The same is true for some other open source math libraries.) Because of the ubiquity and importance of the binomial function we therefore cannot recommend SageMath for the use of implementing sequences on the OEIS.

A plot of log(abs(binomial(x,y))) for x, y in [-5..5] compared to the unmotivated cropped version of SageMath/GKP.

plot3d((x,y) -> log(abs(binomial(x,y))), -5..5, -5..5, grid=[60,60]);  # Maple!
plot3d((x,y) -> if(x<0 and y<0,0,log(abs(binomial(x,y)))), -5..5, -5..5, grid=[60,60]);

Sage users which want to switch to the extended form as described above can use the following function based on Sage's binomial.

def Binomial(n, k):
if n in ZZ and k in ZZ:
if n >= 0:
return binomial(n, k) # Pascal
if k >= 0:
return (-1)^k*binomial(-n+k-1, k) # Taylor
if k <= n:
return (-1)^(n-k)*binomial(-k-1, n-k) # Riordan
return 0
return binomial(n, k)

However if n or k is not in ZZ this function still has its problems. For example

for n in (-5..5): print [Binomial(n+1/2, k+1/2) for k in (-5..5)]

will compute as it should but refuse its service in the case of Binomial(n+1/2,k+1/3). To make it quite clear what response I expect from a CAS in this case: binomial(n+1/2, k+1/3) = C*r(n,k) where r(n,k) is a rational number and C is the constant sqrt(3)*Gamma(2/3)*Gamma(5/6)/Pi^(3/2).