9
$\begingroup$

Working with precision 500 decimal digits, mpmath in sage computes:

$$\sum_{n=2}^\infty (-1)^n\log(n)=\log\left(\frac1 2 \sqrt{2} \sqrt{\pi}\right).\tag{1}\label{1}$$

We believe the LHS of \eqref{1} diverges, so this isn't true.

Q1. Are there theoretical reasons for mpmath to compute \eqref{1}?

online code

Added Despite the interesting answers, I am ready bet mpmath doesn't do any analytic stuff not related to summation, it works purely numerically and the function is treated as black box, returning real number.

$\endgroup$
18
  • 1
    $\begingroup$ It is very frequent that algorithmic summation methods produce a consistent value for divergent series. In Pari/gp, sumalt (designed for convergent alternating series) gives the same result. $\endgroup$
    – Aurel
    Commented May 15, 2022 at 14:31
  • 1
    $\begingroup$ @Wojowu, I think that the reference to working numerically is just the precision with which the CAS claims that the two sides of (1) agree, not a claim about how the CAS arrived at its answer. $\endgroup$
    – LSpice
    Commented May 15, 2022 at 15:25
  • 2
    $\begingroup$ As Aurel says, this phenomenon has already been observed in PARI/GP, see the book by Belabas and Cohen, "Numerical Algorithms for Number Theory - Using PARI/GP", p. 210 mentions exactly the same series. In this book, the computation relies on an efficient algorithm due to Cohen, Rodriguez-Villegas and Zagier for evaluating alternating series. The function used is called SumAlt (p. 209), the PARI/GP code is freely available here: math.u-bordeaux.fr/~kbelabas/Numerical_Algorithms (there is also the built-in PARI/GP function sumalt). $\endgroup$ Commented May 15, 2022 at 22:44
  • 1
    $\begingroup$ @IosifPinelis Assuming we know the algorithm mpmath is using (which should not be too hard to figure out, but the OP should make this precise), it is still a non-trivial math question to show that when applied to this particular series, it recovers the regularised value. $\endgroup$ Commented May 15, 2022 at 23:03
  • 2
    $\begingroup$ @FrançoisBrunault, there's a recent review of resources for (ii) on arxiv. $\endgroup$ Commented May 16, 2022 at 10:41

3 Answers 3

9
$\begingroup$

A summation method for this... $$ F(s) = -\sum_{n=2}^\infty \frac{(-1)^n}{n^s} = -(2^{1-s}-1)\zeta(s) \qquad\text{for $s>0$} $$ Differentiate: $$ \sum_{n=2}^\infty \frac{(-1)^n\log n}{n^s} = F'(s) = 2^{1-s}(\log 2)\zeta(s) - (2^{1-s}-1)\zeta'(s) \qquad\text{for $s>0$} $$

Now the term-by-term limit as $s \to 0^+$ would be $$ \sum_{n=2}^\infty (-1)^n\log n $$ which diverges, but $$ \lim_{s\to 0^+} \big(2^{1-s}(\log 2)\zeta(s) - (2^{1-s}-1)\zeta'(s)\big) = 2(\log 2)\zeta(0) -\zeta'(0) \\ = -\log 2 + \frac{\log(2\pi)}{2} = \frac{\log \pi - \log 2}{2} $$

$\endgroup$
7
$\begingroup$

As shown in my previous answer, the value of the sum that you see is $$\lim_{t\uparrow1}\sum_{n=2}^\infty (-t)^n \ln n. $$

Here is a "manual" way to show this. Writing \begin{equation} \ln n=\int_0^\infty dz\,\frac{e^{-z}-e^{-nz}}z, \end{equation} for $t\uparrow1$ we have \begin{equation} \begin{aligned} &\sum_{n=2}^\infty (-t)^n \ln n \\ &=\sum_{n=2}^\infty (-t)^n \int_0^\infty dz\,\frac{e^{-z}-e^{-nz}}z \\ &=\int_0^\infty \frac{dz}z\sum_{n=2}^\infty (-t)^n (e^{-z}-e^{-nz}) \\ &=\frac{t^2}{1+t}\int_0^\infty \frac{dz}z\,e^{-z}\frac{1-e^{-z}}{1+t e^{-z}} \\ &\to\frac12\int_0^\infty \frac{dz}z\,e^{-z}\frac{1-e^{-z}}{1+e^{-z}} \\ &=-\int_0^1 \frac{dx}{\ln x}\,\frac{1-x}{1+x} = \frac12\,\ln\frac\pi2, \end{aligned} \end{equation} by (say) Formula 4.267.1 on p. 545 in I.S. Gradshteyn and I.M. Ryzhik, Table of Integrals, Series, and Products, Seventh Edition, 2007.

$\endgroup$
2
$\begingroup$

The value of the sum that you see is

$$\lim_{s\downarrow-1}\sum_{n=2}^\infty s^n \ln n. $$

Here is the work in Mathematica:

In[1]:=Sum[s^n Log[n], {n, 2, Infinity}, Assumptions->-1<s<1]
Out[1]=-s^2Derivative[0,1,0][LerchPhi][s,0,2]
In[2]:=Limit[%,s->-1,Direction->"FromAbove"]
Out[2]=-Derivative[0,1,0][LerchPhi][-1,0,2]
In[3]:=FullSimplify[-Derivative[0,1,0][LerchPhi][-1,0,2]]
Out[3]=(1/2)Log[Pi/2]

Added by David Roberts (please see the corresponding comment of mine below): And here is the raw text for copy/paste, with output:

In[1]:=Sum[s^n Log[n], {n, 2, Infinity}, Assumptions->-1<s<1]

Out[1]=-s^2Derivative[0,1,0][LerchPhi][s,0,2]

In[2]:=Limit[%,s->-1,Direction->"FromAbove"]

Out[2]=-Derivative[0,1,0][LerchPhi][-1,0,2]

In[3]:=FullSimplify[-Derivative[0,1,0][LerchPhi][-1,0,2]]
Out[3]=(1/2)Log[Pi/2]
$\endgroup$
7
  • $\begingroup$ I edited in a text equivalent of the Mathematica code. It's a bit less pretty, but hopefully more useful for anyone searching or C&Ping. Please feel free to rollback if the edit was unwelcome. But isn't this a comment, rather than an answer? $\endgroup$
    – LSpice
    Commented May 15, 2022 at 14:44
  • 2
    $\begingroup$ @LSpice : I think readability is more important here, so I did roll it back. I do not see why this may be not an answer. Do you care to explain your comment? In the beginning, I have now added a detail. $\endgroup$ Commented May 15, 2022 at 14:51
  • 1
    $\begingroup$ It's funny—I find text more readable than an image! But of course it's your answer, and I apologise for an unwelcome edit. \\ Your detail in the beginning seems more like an answer, but the original Mathematica code—for someone like me only familiar with Mathematica code to get answers, not to extract the mathematical details—just to be showing that Mathematica produces the same answer; I was not able to extract from it the explanation that you have now added in. $\endgroup$
    – LSpice
    Commented May 15, 2022 at 14:53
  • $\begingroup$ @LSpice : I would agree that such text is more readable by a computer, but hardly by a human. Also, I have now given (in another answer) a possible way for Mathematica's reasoning. $\endgroup$ Commented May 15, 2022 at 17:28
  • 1
    $\begingroup$ @IosifPinelis that's fair. It was a little cheeky of me, but having the raw text there is useful in case people want to play with the example, and not have to type it out afresh based on a picture of the preformatted version (it wasn't clear to me how one would type some of that stuff!). Also, one can paste this into WolframAlpha, if no Mathematica is to hand. $\endgroup$
    – David Roberts
    Commented May 16, 2022 at 23:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .