# Evaluating a symbolic sum

I have read how Mathematica does not have an easy time with symbolic sums, but nevertheless would like to know if anyone can suggest an approach to help Mathematica along.

For:

Sum[(1 - j + m)^(-1 + n) , {j, 1, m - 1}]


I get:

-0^(-1 + n) + (-1)^(1 + n) HurwitzZeta[1 - n, -m]


however with an extra factor of j:

Sum[(1 - j + m)^(-1 + n) j, {j, 1, m - 1}]


it returns unevaluated.

Are there add-on packages which are more successful? Is anyone aware of different software that might do the trick?

Thank you.

• This doesn't answer your question but setting n to a positive integer (and not setting a value for m) does result in a symbolic result.
– JimB
Nov 18 '19 at 17:42
• @JimB, yes, thank you, I did notice that. And also, that the opposite is not true (i.e., setting only m to a positive integer). Nov 18 '19 at 18:16
• Redenoting 1-j+m by k gives Sum[(m - k + 1) k^(n - 1), {k, 2, m}] which evaluates to -m + (1 + m) HarmonicNumber[m, 1 - n] - HarmonicNumber[m, -n] Nov 19 '19 at 6:52
• მამუკა ჯიბლაძე -- thank you for this tip. Nov 21 '19 at 19:59

Consider:

sum = Inactive[Sum][(1 - a j + m)^n, {j, 1, m - 1}];


and differentiate with respect to a:

D[sum, a]


Inactive[Sum][-j (1 - a j + m)^(-1 + n) n, {j, 1, -1 + m}]

Up to a factor of -n (and the presence of the parameter a), this is the sum you're trying to evaluate. So, you're desired result is:

r[m_, n_] = -D[Activate @ sum, a]/n /. a->1


(1/n)((-1)^( 1 + n) (-(1 + m) n HurwitzZeta[1 - n, -1] + (1 + m) n HurwitzZeta[ 1 - n, -m]) + (-1)^(-1 + n) n (-HurwitzZeta[-n, -1] + HurwitzZeta[-n, -m]))

Let's check with some examples. Here's the definition of your sum:

s[m_, n_] := Sum[(1 - j + m)^(n-1) j, {j, 1, m-1}]


And, here's a table of the difference between the result above and your sum for values of m and n running from 1 to 10:

Table[s[m, n] - r[m, n], {m, 10}, {n, 10}] //TeXForm


$$\left( \begin{array}{cccccccccc} 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \end{array} \right)$$

• Carl Woll -- great technique! Thank you so much! :-) Nov 18 '19 at 18:21

Here's a simple algebraic solution.

The trick is to consider a factor (1-j+m) instead of just a factor j, and then subtract the access part (1+m).

Here we go

The sum being immediately evaluated is

s0[n_, m_] := Sum[(1 - j + m)^(n - 1), {j, 1, m - 1}]

s0[n, m]

(* Out[6]= -0^(-1 + n) + (-1)^(1 + n) HurwitzZeta[1 - n, -m] *)


The problem of the OP is the observation that the sum with the factor j

sjU[n_, m_] := Sum[(j) (1 - j + m)^(n - 1), {j, 1, m - 1}]


is returned unevaluated.

Now consider that the sum s0[n+1] which has an additional factor (1 - j + m)

s0[n + 1, m] == Sum[(1 - j + m) (1 - j + m)^(n - 1), {j, 1, m - 1}]

(* Out[8]= True *)


is evaluated.

Noticing that

(1 - j + m) == -j + (1 + m)


the value sjV of our unevaluated sum sjU can be written as a difference

sjV[n_, m_] := -s0[n + 1, m] + (1 + m) s0[n, m]


Comparison between sjU and sjV

And @@ Table[sjU[n, m] == sjV[n, m] // FullSimplify, {n, 1, 10}]

(* Out[10]= True *)


shows agrrement.

Discussion

It is interesting that the sum with the upper summation index extended from m-1 to m

s1[n_, m_] := Sum[(1 - j + m)^(n - 1), {j, 1, m }]


$$\text{Out: }\sum _{j=1}^m (-j+m+1)^{n-1}$$

is returned unevaluated (Version 10.1.0).

While shifting the upper index further, to m+1, works

Sum[(1 + m - j)^(n - 1), {j, 1, m + 1}]

(* Out[25]= (-1)^(1 + n) (HurwitzZeta[1 - n, -m] - Zeta[1 - n]) *)


Hence only the sum ending in the seemingly harmelss term 1^(n-1) is not evaluated.

• Thank you very much for that insightful and helpful trick. Regarding your final comment in the Discussion, it is frustrating to me that, as you showed, the chance of getting a result seems to be highly unpredictable. This is especially true, since from my reading and understanding, the method of the symbolic summation is to first look at the summand only, and if it can be solved, then to plug in the limits of the summation. Nov 20 '19 at 19:26