# Why does Solve and Sum give different answers when according to Table it is the same sequence?

I have been thinking about a piece of code today, but I don't understand why I get different outputs from two in my mind similar Mathematical sums.

First I observe that the Table command for this:

Clear[n, s, a];
s = 1/2;
Table[Total[{1, -a, 1, -a,
1, -a}*{1, 1, -2*a, 1,
1, -2*a}/{(n + 0)^s, (n + 1)^s, (n + 2)^s, (n + 3)^s, (n + 4)^
s, (n + 5)^s}], {n, 1, 36, 6}]


and this:

Clear[n, s, a];
s = 1/2;
Table[Total[{1, -a, 1, -a,
1, -a}*{1, 1, -2*a, 1,
1, -2*a}/{(6*n + 1)^s, (6*n + 2)^s, (6*n + 3)^s, (6*n + 4)^
s, (6*n + 5)^s, (6*n + 6)^s}], {n, 0, 5}]


gives the same output starting:

$$\displaystyle \left\{1+\frac{1}{\sqrt{5}}-\frac{a}{2}-\frac{a}{\sqrt{2}}-\frac{2 a}{\sqrt{3}}+\sqrt{\frac{2}{3}} a^2,\frac{1}{\sqrt{7}}+\frac{1}{\sqrt{11}}-\frac{2 a}{3}-\frac{a}{2 \sqrt{2}}-\frac{a}{\sqrt{10}}+\frac{a^2}{\sqrt{3}},\frac{1}{\sqrt{13}}+\frac{1}{\sqrt{17}}-\frac{a}{4}-\frac{a}{\sqrt{14}}-\frac{2 a}{\sqrt{15}}+\frac{\sqrt{2} a^2}{3},\frac{1}{\sqrt{19}}+\frac{1}{\sqrt{23}}-\frac{a}{2 \sqrt{5}}-\frac{2 a}{\sqrt{21}}-\frac{a}{\sqrt{22}}+\frac{a^2}{\sqrt{6}},\frac{1}{5}+\frac{1}{\sqrt{29}}-\frac{2 a}{3 \sqrt{3}}-\frac{a}{2 \sqrt{7}}-\frac{a}{\sqrt{26}}+\sqrt{\frac{2}{15}} a^2,\frac{1}{\sqrt{31}}+\frac{1}{\sqrt{35}}-\frac{a}{4 \sqrt{2}}-\frac{2 a}{\sqrt{33}}-\frac{a}{\sqrt{34}}+\frac{a^2}{3}\right\}$$...

Then I did these two sums:

Clear[n, s, a];
s = 1/2;
Sum[Total[{1, -a, 1, -a,
1, -a}*{1, 1, -2*a, 1,
1, -2*a}/{(n + 0)^s, (n + 1)^s, (n + 2)^s, (n + 3)^s, (n + 4)^
s, (n + 5)^s}], {n, 1, Infinity, 6}]
Clear[n, s, a];
s = 1/2;
Sum[Total[{1, -a, 1, -a,
1, -a}*{1, 1, -2*a, 1,
1, -2*a}/{(6*n + 1)^s, (6*n + 2)^s, (6*n + 3)^s, (6*n + 4)^
s, (6*n + 5)^s, (6*n + 6)^s}], {n, 0, Infinity}]


which Mathematica 8 evaluates to:

$$\displaystyle \text{Sum}\left[\frac{1}{\sqrt{n}}-\frac{a}{\sqrt{1+n}}-\frac{2 a}{\sqrt{2+n}}-\frac{a}{\sqrt{3+n}}+\frac{1}{\sqrt{4+n}}+\frac{2 a^2}{\sqrt{5+n}},\{n,1,\infty ,6\}\right]$$

$$\displaystyle \sum _{n=0}^{\infty } \left(\frac{1}{\sqrt{1+6 n}}-\frac{a}{\sqrt{2+6 n}}-\frac{2 a}{\sqrt{3+6 n}}-\frac{a}{\sqrt{4+6 n}}+\frac{1}{\sqrt{5+6 n}}+\frac{2 a^2}{\sqrt{6+6 n}}\right)$$

respectively. So far I did not know if these sums are equivalent. Then I wanted to set these sums equal to zero and solve for $a$:

Clear[n, s, a];
s = 1/2;
Solve[Sum[
Total[{1, -a, 1, -a,
1, -a}*{1, 1, -2*a, 1,
1, -2*a}/{(n + 0)^s, (n + 1)^s, (n + 2)^s, (n + 3)^s, (n + 4)^
s, (n + 5)^s}], {n, 1, Infinity, 6}] == 0, a]
Clear[n, s, a];
s = 1/2;
Solve[Sum[
Total[{1, -a, 1, -a,
1, -a}*{1, 1, -2*a, 1,
1, -2*a}/{(6*n + 1)^s, (6*n + 2)^s, (6*n + 3)^s, (6*n + 4)^
s, (6*n + 5)^s, (6*n + 6)^s}], {n, 0, Infinity}] == 0, a]


which outputs:

$\left\{\left\{a\to \left(4 \sqrt{2} \text{HurwitzZeta}\left[\frac{1}{2},\infty \right]-4 \text{Zeta}\left[\frac{1}{2}\right]+2 \sqrt{2} \text{Zeta}\left[\frac{1}{2}\right]-\sqrt{2} \text{Zeta}\left[\frac{1}{2},\frac{1}{3}\right]-\sqrt{2} \text{Zeta}\left[\frac{1}{2},\frac{2}{3}\right]-\surd \left(\left(-4 \sqrt{2} \text{HurwitzZeta}\left[\frac{1}{2},\infty \right]+4 \text{Zeta}\left[\frac{1}{2}\right]-2 \sqrt{2} \text{Zeta}\left[\frac{1}{2}\right]+\sqrt{2} \text{Zeta}\left[\frac{1}{2},\frac{1}{3}\right]+\sqrt{2} \text{Zeta}\left[\frac{1}{2},\frac{2}{3}\right]\right)^2-4 \left(2 \sqrt{2} \text{HurwitzZeta}\left[\frac{1}{2},\infty \right]-2 \sqrt{2} \text{Zeta}\left[\frac{1}{2}\right]\right) \left(2 \sqrt{2} \text{HurwitzZeta}\left[\frac{1}{2},\infty \right]-\sqrt{2} \text{Zeta}\left[\frac{1}{2},\frac{1}{6}\right]-\sqrt{2} \text{Zeta}\left[\frac{1}{2},\frac{5}{6}\right]\right)\right)\right)/\left(2 \left(2 \sqrt{2} \text{HurwitzZeta}\left[\frac{1}{2},\infty \right]-2 \sqrt{2} \text{Zeta}\left[\frac{1}{2}\right]\right)\right)\right\},\left\{a\to \left(4 \sqrt{2} \text{HurwitzZeta}\left[\frac{1}{2},\infty \right]-4 \text{Zeta}\left[\frac{1}{2}\right]+2 \sqrt{2} \text{Zeta}\left[\frac{1}{2}\right]-\sqrt{2} \text{Zeta}\left[\frac{1}{2},\frac{1}{3}\right]-\sqrt{2} \text{Zeta}\left[\frac{1}{2},\frac{2}{3}\right]+\surd \left(\left(-4 \sqrt{2} \text{HurwitzZeta}\left[\frac{1}{2},\infty \right]+4 \text{Zeta}\left[\frac{1}{2}\right]-2 \sqrt{2} \text{Zeta}\left[\frac{1}{2}\right]+\sqrt{2} \text{Zeta}\left[\frac{1}{2},\frac{1}{3}\right]+\sqrt{2} \text{Zeta}\left[\frac{1}{2},\frac{2}{3}\right]\right)^2-4 \left(2 \sqrt{2} \text{HurwitzZeta}\left[\frac{1}{2},\infty \right]-2 \sqrt{2} \text{Zeta}\left[\frac{1}{2}\right]\right) \left(2 \sqrt{2} \text{HurwitzZeta}\left[\frac{1}{2},\infty \right]-\sqrt{2} \text{Zeta}\left[\frac{1}{2},\frac{1}{6}\right]-\sqrt{2} \text{Zeta}\left[\frac{1}{2},\frac{5}{6}\right]\right)\right)\right)/\left(2 \left(2 \sqrt{2} \text{HurwitzZeta}\left[\frac{1}{2},\infty \right]-2 \sqrt{2} \text{Zeta}\left[\frac{1}{2}\right]\right)\right)\right\}\right\}$

and the empty set:

$\{\}$

respectively.

For numerical reasons (setting infinity to a large number and evaluating) I believe that the complicated Zeta function expression is incorrect and that this is bug.

But I have a feeling though that the fault might have been made by me and not Mathematica. Where did I go wrong? Should the two sums give the same answer?

-

So if i understand correctly you want to verify the equality of the two sums $$\sum_{k=0}^\infty \frac{1}{n^s}-\frac{a}{(n+1)^s}-\frac{2 a}{(n+2)^s}-\frac{a}{(n+3)^s}+\frac{1}{(n+4)^s}+\frac{2 a^2}{(n+5)^s} \;\text{where}\quad n=6k+1$$ and $$\sum_{k=0}^\infty \frac{1}{(6 n+1)^s}-\frac{a}{(6 n+2)^s}-\frac{2 a}{(6 n+3)^s}-\frac{a}{(6 n+4)^s}+\frac{1}{(6 n+5)^s}+\frac{2 a^2}{(6 n+6)^s}\;\text{where}\quad n=k$$ . You can verify this by executing the substitution in the first sum and comparing the summands of both sums. In Mathematica you could e.g. do it like this: With your definitions:

summand1 = Total[{1, -a, 1, -a, 1, -a}
*{1, 1, -2*a, 1, 1, -2*a}
/{(n+0)^s, (n+1)^s, (n+2)^s, (n+3)^s, (n+4)^s, (n+5)^s}]
summand2 = Total[{1, -a, 1, -a, 1, -a}
*{1, 1, -2*a, 1, 1, -2*a}
/{(6*n+1)^s, (6*n+2)^s, (6*n+3)^s, (6*n+4)^s, (6*n+5)^s, (6*n+6)^s}]

{summand1 /. n->6*k+1, summand2 /. n-> k}


which give the same result:

Subtract @@ %
(* 0 *)

-

I don't believe there is a solution to the mathematical problem you are posing. Look at the second form of the series for large n.

Series[1/Sqrt[1 + 6 n] - a/Sqrt[2 + 6 n] - (2 a)/Sqrt[3 + 6 n] - a/Sqrt[4 + 6 n] + 1/Sqrt[5 + 6 n] + (2 a^2)/Sqrt[6 + 6 n], {n, \[Infinity], 2}]


yields

1/3 (Sqrt[6] - 2 Sqrt[6] a + Sqrt[6] a^2) Sqrt[1/n] + (-(1/(2 Sqrt[6])) + a/Sqrt[6] - a^2/Sqrt[6]) (1/n)^(3/2) + SeriesData[n, DirectedInfinity[1], {}, 1, 5, 2]


Unless the coefficient of Sqrt[1/n] is 0, that is a=1, the series diverges. However, if you set a=1 (the only value for which the infinite series converges) then the sum is what it is; it can't be set to zero. Numerically, it looks like it is less than -0.4.

While it's understandle that Mathematica could not solve the problem, I have no idea why it responded with the nonsense that it did.

-
Since you commented about the case "a=1", the value less than -0.4 is conjectured to be: s = 1/2; N[Zeta[s] (1 - 1/2^(s - 1) - 1/3^(s - 1) + 1/6^(s - 1)), 15] =-0.442816540414123... –  Mats Granvik Jun 24 '12 at 5:54
+1 You can also arrive at this conclusion by expanding the summand as a series in $n$ around $\infty$: the leading term, of order $n^{-1/2}$, has $2(1-a)^2$ for its coefficient. Because this will not converge when summed, the coefficient must equal zero. I suspect MMA obtained its solution by interpreting these summations as the analytic continuation of $\zeta(1/2,\ldots)$. –  whuber Jun 24 '12 at 15:00