# Sum of binomials gives indeterminate result... why?

I am defining a function that involves a sum of binomial coefficients:

a[r_, k_, mx_] = Sum[Binomial[r + 2*k - d, d], {d, k, mx}]


For some inputs, this works fine. For others, it gives an indeterminate result. For instance:

In[235]:= a[4, 1, 3]

Infinity::indet: Indeterminate expression 0 ComplexInfinity encountered. >>


There is no issue when computing the same sum but not as a function e.g.

In[232]:= Sum[Binomial[4 + 2*1 - d, d], {d, 1, 3}]
Out[232]= 12


Moreover, the sum in this case amounts to 5+6+1=12, so nothing strange is going on.

Any suggestions of what is going wrong and how to fix it? I have a feeling it has something to do with the HypergoemtricPFQ function that is used to evaluate the Binomial expressions. Thanks!

• You should use := when setting the function Aug 3 '16 at 17:23
• "I have a feeling it has something to do with the HypergeometricPFQ[]" - yes, the result returned is only generically correct, and can fail for special inputs, which unfortunately are the ones you're interested in. Aug 3 '16 at 17:34

Use SetDelayed to define your function:
In[24]:= a[r_, k_, mx_] := Sum[Binomial[r + 2*k - d, d], {d, k, mx}]