9
$\begingroup$

The question is: Can I ask the Mathematica kernel directly what it takes as the definition of the built-in symbol XY? After all this has to be in the kernel. And if the documentation is not giving any hint as in the following example I’d like to know with what I’m working.

The change of the definition of Binomial[] from M7 to M8 serves as an example. The Mathworld entry for the Binomial Coeffcient mentiones the change. Mathematica’s online help does not. It just gives the general definition for complex $x, y$:

$$\binom{x}{y}=\frac{\Gamma(x+1)}{\Gamma(y+1)\Gamma(x-y+1)}.$$

But for sure Mathematica knows about the special case $n,k\in\mathbb{N}$:

$$\binom{n}{k}=\begin{cases}\frac{n!}{k!(n-k)!}&0\le k \le n\\0&\text{otherwise}\end{cases}$$

As found in Kronenburg’s arxiv paper the definition can be extended to $n<0$. Note that the Gamma function is infinite for negative integers arguments, so this is an extension even to the general complex definition given above. Kronenburg basically extends Pascals Triangle upwards for negative $n$.

This change however breaks many equations involving binomials found in the books like Concrete Mathematics and Analytic Combinatorics. For example generalized Fibonacci Numbers where the sum of the last $r$ terms gives the next term, is given by

$$c_n^r=\sum_{j,k}\binom{j}{k}\binom{n-rk-1}{j-1}(-1)^k$$

As customary the indices $j$ and $k$ range over integer interval $[0..\infty]$ and the binomial coefficients are $0$ according to the second definition effectively making this series finite. This “trick” or some may say this “abuse of notation” is widely used as it allows to work with identities involving binomial coefficients quite nicely.

The change of the definition leads to $c_n^r$ having different results in M7 and M8.


EDIT: I like to give another example, besides the bionomial coefficient one from above, why I want to have a look at the definitions.

With Mathematica you can specify Forms for the output, e.g. TeXForm or TraditionalForm. Moreover you can create your own output forms. Typically one does not want to start from the scratch, but just modify a thing or two in the existing ones. To be able to do that, I first need to look at the definition. I’m aware of the fact, that forms like TraditionalForm consist of a large collection of rules to produce an approximation to traditional mathematical notation. For this very reason I don’t want to collect all the rules myself (I’m sure I’ll never succeed). I want to build on the work that was already done. I like standing on the shoulders of giants.

$\endgroup$
6
  • 1
    $\begingroup$ Barring either looking at the manual or checking what's under the hood through the judicious use of Unprotect[] and ClearAttributes[], I don't see how. $\endgroup$ Jan 18, 2012 at 13:30
  • 2
    $\begingroup$ It feels like the question is asked as an excuse to express your gripes with the binomial. I think you should consider editing the question so it either directly asks about binomial, or remove the long preamble which is not really relevant to the question. I would have never guessed the question has to do with Binomial from the title. $\endgroup$
    – Sasha
    Jan 18, 2012 at 13:41
  • $\begingroup$ I like general definitions, so I don’t have gripes with Binomial. It is just an example why I want to ask the kernel questions about the definitions it’s using. If had posted just this single line question. I’m sure the comment would have been “Give an example were you want to do that.” $\endgroup$
    – uli
    Jan 18, 2012 at 13:46
  • $\begingroup$ Perhaps you could avoid misunderstandings by starting the question by: "Can I ask the Mathematica kernel..." etc, then below that add the motivation (ie, move the last paragraph to first). $\endgroup$
    – acl
    Jan 18, 2012 at 13:51
  • 1
    $\begingroup$ About the "After all this has to be in the kernel": While it has to be in the kernel in some way, it might be in a way not accessible by Mathematica code, for example in form of an if statement in the C code implementing the function. I have no idea whether this is the case for Binomial but I'd not be surprised if it were. $\endgroup$
    – celtschk
    Jan 18, 2012 at 17:07

1 Answer 1

9
$\begingroup$

Since there are two parts to your question. I will address the one directly dealing with Binomial.

For the purposes of discrete mathematics, the binomial is defined through its generating function: $$ (1+x)^{\alpha} = \sum_{m=0}^\infty \binom{\alpha}{m} x^m $$ It makes evaluations of sums using generating functions much easier if the sum were to run over all integers. So it is natural, in this context, to set $\binom{\alpha}{m} = 0$, $\forall m \in \mathbb{Z}_{< 0}$.

And this convention is indeed adopted in two books you link to, at the expense of breaking the symmetry $\binom{\alpha}{m} = \binom{\alpha}{\alpha-m}$, as explicitly emphasized in "Concrete Mathematics".

In Mathematica, Binomial[z,w] is a defined over $\mathbb{C} \times \mathbb{C}$, and the aforementioned symmetry holds almost everywhere, justifying automatic evaluation

In[62]:= Binomial[n, n - 3]

Out[62]= 1/6 (-2 + n) (-1 + n) n

But the symbolic polynomial above does not give zero for $n \in \mathbb{Z}_{\leqslant -1}$, so we have an inconsistency.

In order to fix all the sums for $c^r_n$ one may use Boole (also known as Iverson bracket). In fact it seems that this particular sum requires Boole even in version 7:

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.