Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Prompt 3 (skipped 2, since covered by prompt 1): Why does Mathematica give the wrong value for Binomial[-1,-1]? Let's think step by step.

Response 3: The binomial coefficient is defined as:

Binomial[n, k] = n! / (k! * (n-k)!)

where n! denotes the factorial of n, i.e., the product of all positive integers less than or equal to n. Factorial is defined only for non-negative integers. However, Mathematica extends the factorial function and the binomial coefficient function to handle negative integers and non-integer numbers using the Gamma function.

For a non-negative integer n, the relationship between the factorial function and the Gamma function is:

Gamma[n+1] = n!

For other complex numbers z except non-positive integers (i.e., 0, -1, -2, ...), the Gamma function is defined as:

Gamma[z] = Integral[t^(z-1) * Exp[-t], {t, 0, Infinity}]

Now let's consider the Binomial[-1, -1]. Using the definitions above, we have:

Binomial[-1, -1] = Gamma[-1+1] / (Gamma[-1+1] * Gamma[-1-(-1)+1]) = Gamma[0] / (Gamma[0] * Gamma[1])

Note that Gamma[1] = 1! = 1.

However, the Gamma function has a problem when dealing with non-positive integers. It has "poles" at these points, meaning that the Gamma function goes to infinity:

Gamma[0] -> Infinity

So, we have:

Binomial[-1, -1] = Infinity / (Infinity * 1) = Indeterminate

Mathematica, however, might give the value of Binomial[-1, -1] as 1. This result comes from directly applying the reflection formula for the Gamma function:

Gamma[z] * Gamma[1-z] = Pi / Sin[Piz]

For z = 0, we get:

Gamma[0] Gamma[1-0] = Pi / Sin[Pi0] Infinity 1 = Pi / 0 1 = Pi / Infinity

This leads to the result of Binomial[-1,-1] = 1, which is incorrect and a potential issue with Mathematica's handling of the Gamma function for certain cases.

The value Binomial[-1, -1] should be treated as an indeterminate form rather than a specific value due to the ambiguity in the Gamma function's behavior at non-positive integers.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: