Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having some real trouble with Mathematica wrongly evaluating various symbolic sums at the moment. I have this function:

$$h_{ij}(x) = \binom{j-1}{i-1}-\sum_{r=0}^{j-x-n-(k+1)/2-1}\binom{r+x+n+(1-k)/2}{i-k}\binom{j-r-x-n-5/2+k/2}{k-2}$$

and I use it in the following double summation:

$$\sum_{1\leq s<t\leq2x+2n+1}h_{is}(x)h_{jt}(x)-h_{it}(x)h_{js}(x)$$

and I want to know what this summation is as a polynomial in $x$. The values $i,j,k,n$ are all integers, and it can be assumed that $x>0$. Here is my Mathematica input for $h(x)$ (with a slight change of variable in the summand):

h[i_, j_, k_, x_, n_] := 
 (Binomial[j - 1, i - 1] - 
  2*Sum[Binomial[r + i - k, i - k]*Binomial[j - i - r + k - 2, k - 2], 
  {r, x + n + (k + 1)/2 + 1 - i, j - i}])

and here is my code for the double summation:

summ[i_, j_, k_, x_, n_] :=
 Sum[h[i, s, k, x, n]*h[j, t, k, x, n] - h[i, t, k, x, n]*h[j, s, k, x, n],
  {t, 2, 2*x + 2*n + 1}, {s, 1, t - 1}]

Now the thing that is really bothering me is a discrepency between evaluating these functions where $x$ is undetermined. I know from other calculations that when $x=1,i=1,j=3,k=3$ and $n=2$, the function summ should return 96, which it does. However if leave $x$ undetermined I get the following output:

1/3 (x + 2) (x + 3) (2 x + 5)^2          

Which gives 196 when $x=1$, which is a) in disagreement with my other calculations; and b) in disagreement with Mathematica's answer for when I specify $x=1$. Please can someone help me understand why this happens? It's driving me up the wall.

share|improve this question
So I've been looking into it a little further, and I think the problem may arise in the way that Mathematica deals with and transforms Hypergeometric series. The sum contained in the function h can be expressed as a 3F2 Hypergeometric series, and I have a feeling that when this is put into a larger sum Mathematica has no idea about the values that the variables may legally take, and hence could be applying wrong transformations. Has anyone had this problem before? I'm currently trying to manipulate some fairly hideous hypergeometric series in order to try and fix this problem. – user2025161 Oct 31 '13 at 15:34

Selecting a regularization option (ok, this is a hack), e.g.,

SetOptions[Sum, Regularization -> "Abel"]

will prevent sums such as


from being (incorrectly) evaluated. To determine the correct closed form for these cases, one can then use interpolation, e.g.,

Factor@InterpolatingPolynomial[Table[{x, summ[1, 3, 3, x, 2]}, {x, 20}], x]

1/6 (x + 2)^2 (x + 3) (5 x + 11)

which gives the correct result for all x.

It may be useful to provide more context on the problem, to see if the issues you're facing here can be avoided (e.g. by using generating function methods).

share|improve this answer
Thank you for your suggestion. – user2025161 Nov 21 '13 at 19:16

I've solved this by expanding out all of the summands and playing around with the ranges over the various summations. I had to analyse which values of k, n, s and t actually contributed to the sum, and change the summation ranges accordingly for each individual summand in the expanded expression for summ.

share|improve this answer
Please include the code that you used to solve this question of yours so that others can also benefit from it. – R. M. Nov 21 '13 at 19:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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