6
$\begingroup$

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.

$\endgroup$
8
  • 3
    $\begingroup$ I'm voting to close this question as off-topic because it is not about Mathematica. W|A is considered off-topic. $\endgroup$
    – Szabolcs
    Dec 9, 2016 at 9:20
  • $\begingroup$ @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}] $\endgroup$ Dec 9, 2016 at 10:37
  • $\begingroup$ 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. $\endgroup$
    – george2079
    Dec 9, 2016 at 12:51
  • $\begingroup$ I think this actually is a problem with Mathematica and so may be on topic. See my answer. $\endgroup$ Dec 9, 2016 at 13:12
  • 1
    $\begingroup$ @SimonRochester The question could be converted but it hasn't been. You could edit it to change the focus to be on-topic. $\endgroup$
    – Michael E2
    Dec 9, 2016 at 14:43

2 Answers 2

10
$\begingroup$

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.

$\endgroup$
1
  • 1
    $\begingroup$ Definitely a bug. The correct closed form is obtained if one replaces LerchPhi[] with HurwitzLerchPhi[], which has the correct branch cut behavior. $\endgroup$ Dec 9, 2016 at 19:41
3
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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