# Mathematica Infinite Summation Confusion

I am a student studying Fourier series solutions to linear second order differential equations. In the process of wanting to verify an answer to an exercise I did by hand, I wanted Wolfram|Alpha to compute this infinite sum:

$$\sum_{n=1}^{\infty} \frac{2 (-1)^{n + 1}}{-n^2 + 3}$$

I expect the result to be about 2.765 based on the partial series output that Wolfram|Alpha gives me, but I spent a long time very confused since the top result given is a decimal representation of about 1.187. I do not understand how Wolfram|Alpha arrived at the latter result especially since it knows that the partial sums approach 2.765.

Is there some explanation for this difference in output? My confusion is probably worsened by the fact that I do not really use Mathematica or Wolfram|Alpha very frequently.

### Edit

As suggested by Simon Rochester, this question can be converted to a question about Mathematica due to the difference in the output of the commands:

N @ Table[Sum[(2 (-1)^(n + 1))/(-n^2 + 3), {n, 1, m}], {m, 1, 20}]


and

N @ Table[Evaluate @ Sum[(2 (-1)^(n + 1))/(-n^2 + 3), {n, 1, m}], {m, 1, 20}]


The second of these seems to give unexpected results.

• I'm voting to close this question as off-topic because it is not about Mathematica. W|A is considered off-topic. – Szabolcs Dec 9 '16 at 9:20
• @Szabolcs Looks like this question could be converted to a Mathematica question: compare N@Table[Sum[(2 (-1)^(n + 1))/(-n^2 + 3), {n, 1, m}], {m, 1, 20}] and N@Table[Evaluate@Sum[(2 (-1)^(n + 1))/(-n^2 + 3), {n, 1, m}], {m, 1, 20}] – Simon Rochester Dec 9 '16 at 10:37
• fwiw alphas error seems to be exactly 1/Sqrt[3]+1 (It shows a plot that clearly converges to the correct result too.) I guess you get what you pay for. voting to close as off topic. – george2079 Dec 9 '16 at 12:51
• I think this actually is a problem with Mathematica and so may be on topic. See my answer. – Simon Rochester Dec 9 '16 at 13:12
• @SimonRochester The question could be converted but it hasn't been. You could edit it to change the focus to be on-topic. – Michael E2 Dec 9 '16 at 14:43

## 2 Answers

The problem is with Mathematica's result for the symbolic partial sum:

Sum[(2 (-1)^(n + 1))/(-n^2 + 3), {n, 1, m}]
(* -(1/Sqrt[3])(LerchPhi[-1, 1, 1 - Sqrt[3]] - LerchPhi[-1, 1, 1 + Sqrt[3]] + (-1)^(1 + m) LerchPhi[-1, 1, 1 - Sqrt[3] + m] + (-1)^m LerchPhi[-1, 1, 1 + Sqrt[3] + m]) *)

Limit[%, m -> Infinity]
(* (-LerchPhi[-1, 1, 1 - Sqrt[3]] + LerchPhi[-1, 1, 1 + Sqrt[3]])/Sqrt[3] *)

% // N
(* 1.18789 *)


This does not agree with the correct result for the infinite sum:

Sum[2 (-1)^(n + 1)/(-n^2 + 3), {n, 1, Infinity}]
(* (-1 + Sqrt[3] - 3 \[Pi] Csc[Sqrt[3] \[Pi]] + Sqrt[3] \[Pi] Csc[Sqrt[3] \[Pi]])/(3 (-1 + Sqrt[3])) *)

% // N
(* 2.76524 *)


This has got to be a Mathematica bug. As such I think this question is on topic.

• Definitely a bug. The correct closed form is obtained if one replaces LerchPhi[] with HurwitzLerchPhi[], which has the correct branch cut behavior. – J. M. will be back soon Dec 9 '16 at 19:41

This a Mathematica forum. I don't see any problem with the sum of the series under consideration:

Sum[2*(-1)^(n + 1)/(-n^2 + 3), {n, 1, Infinity}]


(-1 + Sqrt[3] - 3 [Pi] Csc[Sqrt[3] [Pi]] + Sqrt[3] [Pi] Csc[Sqrt[3] [Pi]])/(3 (-1 + Sqrt[3]))

N[%]


2.76524

NSum[2*(-1)^(n + 1)/(-n^2 + 3), {n, 1, Infinity}]


2.76524