24
$\begingroup$

Backslide introduced in 9.0, and persisting through 12.0.


A friend of mine showed me this example:

Limit[Sum[Sin[Pi*k/n]/(n + 1/k), {k, 1, n}], n -> Infinity]

This sample calculates well in v8.0.4:

enter image description here

but not in v9.0.1 and v10.0 (tested on Cloud):

enter image description here

enter image description here

So this seems to be a backslide.

Any work-around?


Addendum

There's no doubt that the answer for the infinite summation is $2/\pi$, this can be proved by squeeze theorem:

$$\because 0\leq1/k\leq1$$ $$\therefore \lim_{n\to \infty } \, \left(\sum _{k=1}^n \frac{\sin \left(\frac{\pi k}{n}\right)}{n+1}\right)\leq\lim_{n\to \infty } \, \left(\sum _{k=1}^n \frac{\sin \left(\frac{\pi k}{n}\right)}{\frac{1}{k}+n}\right)\leq\lim_{n\to \infty } \, \left(\sum _{k=1}^n \frac{\sin \left(\frac{\pi k}{n}\right)}{n}\right)$$ $$ \lim_{n\to \infty } \, \frac{n \sum _{k=1}^n \frac{\sin \left(\frac{\pi k}{n}\right)}{n}}{n+1}\leq\lim_{n\to \infty } \, \left(\sum _{k=1}^n \frac{\sin \left(\frac{\pi k}{n}\right)}{\frac{1}{k}+n}\right)\leq\lim_{n\to \infty } \, \left(\sum _{k=1}^n \frac{\sin \left(\frac{\pi k}{n}\right)}{n}\right)$$ $$\because\lim_{n\to \infty } \, \left(\sum _{k=1}^n \frac{\sin \left(\frac{\pi k}{n}\right)}{n}\right)=\int_0^1 \sin (\pi x) \, dx=\frac{2}{\pi }$$ $$\lim_{n\to \infty } \, \frac{n}{n+1}=1$$ $$\therefore\lim_{n\to \infty } \, \left(\sum _{k=1}^n \frac{\sin \left(\frac{\pi k}{n}\right)}{\frac{1}{k}+n}\right)=\frac{2}{\pi }$$

$\endgroup$
  • 1
    $\begingroup$ @Jinxed The sum is a Riemann Sum for Integrate[Sin[Pi x], {x, 0, 1}], which equals 2/Pi. $\endgroup$ – Michael E2 Apr 2 '15 at 13:07
  • 1
    $\begingroup$ @xzczd Yes, that's quite nice, but I did not doubt the result. Note that the LHS is also a Riemann sum for the same integral if you sum $k=0$ to $n$ with $n+1$ intervals. $\endgroup$ – Michael E2 Apr 3 '15 at 2:47
  • 1
    $\begingroup$ @MichaelE2 Yeah, I know, I just feel obligated to remind all the people who take part in the discussion for the correctness of v8 :) $\endgroup$ – xzczd Apr 3 '15 at 2:54
  • 1
    $\begingroup$ By Laplace Transform: InverseLaplaceTransform[ Limit[Sum[ LaplaceTransform[Exp[I a*Pi*k/n]/(n + 1/k), a, s], {k, 1, n}] // FullSimplify, n -> Infinity, Assumptions -> s > 0], s, 1] // Im $\endgroup$ – Mariusz Iwaniuk Apr 2 '18 at 14:43
  • 1
    $\begingroup$ Another workaround is to find the series at infinity. In[60]:= Series[ Sum[Sin[Pi*k/n]/(n + 1/k), {k, 1, n}], {n, \[Infinity], 0}] // Normal // Expand Out[60]= 2/\[Pi] $\endgroup$ – Chip Hurst Apr 2 '18 at 21:42
5
$\begingroup$

One possible workaround is to use the new in M12 function AsymptoticSum:

AsymptoticSum[Sin[Pi k/n]/(n + 1/k), {k, 1, n}, {n, ∞, 1}]

2/𝜋

$\endgroup$
4
$\begingroup$

Yesterday I found the approach below with Hold/ReleaseHold on v10.0.0 on Win8.1 achieves the same result as v8.0.4, namely, it gives a limit of $\frac{2}{\pi}$.

ReleaseHold@Limit[
    Hold[
        Sum[Sin[Pi*k/n]/(n + 1/k), {k, 1, n}]
    ], n -> Infinity]
(* 2/Pi *)

However, on v10.0.2 on Linux, this approach gives the result shown below...as does Wolfram Alpha. Also in a comment by Jinxed below, apparently this is the result in v10.1! Can anyone confirm the result on other operating systems or versions?

$Version
(* 10.0 for Linux x86 (64-bit) (December 4, 2014) *)

Limit[Sum[Sin[Pi*k/n]/(n + 1/k), {k, 1, n}], n -> Infinity]

enter image description here


Addendum

Numerically, one can try this to investigate the behaviour of the function as n increases, and it looks like $\frac{2}{\pi}$ is along the right lines.

func = Compile[{{n, _Integer}},
            2/Pi - Sum[Sin[Pi*k/n]/(n + 1/k), {k, 1, n}]
       ];
data = Table[func[n], {n, 10000}];
ListLogPlot[data, Frame -> True, FrameLabel -> {"n", "func[n]"}]

enter image description here

On top of that, you can convert the LerchPhi mess into a function and plot the behaviour of that (include Chop to remove some small imaginary components). It's the same behaviour as the original sum:

func2[n_] := 2/Pi - Chop@N@(-((1/(2*(-1 + E^((I*Pi)/n))*n^2))*((I*((-E^((I*Pi)/n))*n - E^((2*I*Pi)/n)*n + (E^(-((I*Pi)/n)))^(-1 + n)*n + E^((2*I*Pi)/n)*(E^((I*Pi)/n))^n*n - LerchPhi[E^(-((I*Pi)/n)), 1, 1 + 1/n] +  E^((I*Pi)/n)*  LerchPhi[E^(-((I*Pi)/n)), 1,    1 + 1/n] - (E^(-((I*Pi)/n)))^(-1 + n)*  LerchPhi[E^(-((I*Pi)/n)), 1,    1 + 1/n + n] + (E^(-((I*Pi)/n)))^n*  LerchPhi[E^(-((I*Pi)/n)), 1, 1 + 1/n + n] +  E^((2*I*Pi)/n)*LerchPhi[E^((I*Pi)/n), 1, 1 + 1/n] - E^((3*I*Pi)/n)*LerchPhi[E^((I*Pi)/n), 1, 1 + 1/n] -  E^((2*I*Pi)/n)*(E^((I*Pi)/n))^n*LerchPhi[E^((I*Pi)/n), 1, 1 + 1/n + n] + E^((3*I*Pi)/n)*(E^((I*Pi)/n))^n*LerchPhi[E^((I*Pi)/n), 1, 1 + 1/n + n]))/E^((I*Pi)/n))))?Q

data2 = ParallelTable[func2[n], {n, 1, 1000, 5}];
ListLogPlot[Transpose[{Range[1, 1000, 5], data2}], 
      Frame -> True, FrameLabel -> {"n", "func2[n]"}]

enter image description here

$\endgroup$
  • 1
    $\begingroup$ My guess is that version 8 can't symbolically evaluate the Sum, which would have the same effect as using Hold/ReleaseHold in 9 and 10. $\endgroup$ – 2012rcampion Apr 1 '15 at 14:21
  • $\begingroup$ @2012rcampion Interesting idea! $\endgroup$ – dr.blochwave Apr 1 '15 at 14:22
  • $\begingroup$ @xzczd, can you try evaluating the sum by itself in v8? $\endgroup$ – 2012rcampion Apr 1 '15 at 14:24
  • 1
    $\begingroup$ @blochwave, @xzczd: The Hold-ReleaseHold-approach does not work in 10.1! $\endgroup$ – Jinxed Apr 1 '15 at 19:27
  • $\begingroup$ @Jinxed Oh! What does it give, out of interest? $\endgroup$ – dr.blochwave Apr 1 '15 at 20:12
4
$\begingroup$

Update

Since you gave a good proof, that $2/\pi$ is the correct solution, Mathematica is obviously failing at the task. The question is, why.

Analysis of Mathematica's behavior

First, the sum you gave is no Riemann sum:

You defined the intervals as $$\Delta x_k=\frac{1}{n+1/k}$$ so $k/n$ does not lie within the appropriate subinterval, e.g. for $n=10$, $k/n=\frac{1}{10}$ (with $k=1$), while the interval width $1/(n+1/k)=\frac{1}{11}$ is less, observe:

NumberLinePlot@{Flatten@{FoldList[Plus, 0, 
 Table[(10 + 1/k)^-1, {k, 1, 10}]], 1}, Table[k/10, {k, 1, 10}]}

intervals vs. parameters to Sin

So, this is no Riemann sum. Mathematica deals with Rieman sums easily:

General Riemann-sum

Riemann sum for $[a,b]$:

riemann[f_,a_,b_,n_]:=With[{dx=(b-a)/n}, dx Sum[f[k dx], {k, 1, n}]]

Limit[riemann[Sin[\[Pi] #]&, 0, 1, n], n->Infinity]
(* 2/\[Pi] *)

Mathematica's behavior

We have no Riemann sum here. Mathematica now seems to resort to LerchPhi and exponentialization, as soon as $k$ and $n$ appear together in the sum's divisor, possibly due to the Lerch zeta-function being defined as:

$$L(\lambda ,n ,s)=\sum _{{k=0}}^{\infty }{\frac {\exp(2\,\pi \,i\,\lambda \,k)}{(k+n)^{s}}}$$

Now, Mathematica seems to find enough resemblance in this to begin transforming the original summand into a Lerch-based form, ending up with the complex expression in the question, for which it then cannot find a limit anymore.

Conclusion: Solution?

Having tried a number of documented summation methods in Sum, none of them prevent the expansion to Lerch. Since @blochwave's Hold and ReleaseHold does not work in 10.1 anymore, I am at a loss on how to actually have Mathematica find the limit of $2/\pi$.

The solution would be to prevent Mathematica from trying LerchPhi at all - how this might be accomplished is however beyond me. :|

$\endgroup$
  • $\begingroup$ +1 interesting work - I like it! The behaviour of the different versions of MMA w.r.t Hold/ReleaseHold is odd though - esp. on different OSs $\endgroup$ – dr.blochwave Apr 2 '15 at 14:52
  • 1
    $\begingroup$ Aren't all the answers returned by the different Mathematica versions in fact equal? I can't check now, but I thought that's what I got. $\endgroup$ – Michael E2 Apr 2 '15 at 15:26
  • 1
    $\begingroup$ @blochwave: What I wanted to say was: I am unable to manually evaluate the (long, LerchPhi) result myself. I just think, that the OP's original query does not immediately lend itself as being similar (or even equal) to the Riemann sum. $\endgroup$ – Jinxed Apr 2 '15 at 17:54
  • 1
    $\begingroup$ I'm sorry but the answer given by v8 is undoubtedly correct. See my edit for the step-by step proof. @blochwave $\endgroup$ – xzczd Apr 3 '15 at 2:33
  • 1
    $\begingroup$ @xzczd, @blochwave: I think I might have found a reason for LerchPhi showing up at all (see my update). Alas, now it seems utterly impossible to have Mathematica come up with the right result at all. $\endgroup$ – Jinxed Apr 3 '15 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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