Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica 3.0.0 bug in LerchPhi function

  • To: mathgroup at
  • Subject: [mg9089] Re: [mg9065] Mathematica 3.0.0 bug in LerchPhi function
  • From: David Withoff <withoff>
  • Date: Mon, 13 Oct 1997 23:33:05 -0400
  • Sender: owner-wri-mathgroup at

> In article <6171ii$osf at>, luca ciotti
> <ciotti at> wrote:
> >  I found a problem in symbolic summation using Mathematica 3.0.0.
> > 
> >  A = Sum[ Exp[-k]/(1+k^3), {k,0,Infinity}]
> > 
> > The analitycal result, when evaluated numerically  is
> > 
> >                           N[A,50] = 0.5344386.....
> > 
> > 
> > This is obviously wrong, in fact each term of the series is 
> > positive, and the first (k=0) is equal 1.
> > 
> > Performing directly NSum, return 1.20111.....
> Hi,
> I verified the exact symbolic result which is given by Mathematica and it
> is correct (albeit written up in a too complicated way, even after
> Simplify...). When you write it as
> (2 + (-1)^(2/3)/E*LerchPhi[1/E, 1, (-1)^(1/3)] - 
>     (-1)^(1/3)/E*LerchPhi[1/E, 1, -(-1)^(2/3)] - 
>     E*Log[1 - 1/E])/3
> then even Mathematica is able to evaluate it correctly.
> The actual problem is a major bug in the numerical calculation of the
> LerchPhi function: Try e.g.
> z = 0.4; v = -0.5; Plot[NSum[z^n/(n + v), {n, 0, 20}] - 
>     LerchPhi[z, 1, v], {v, -1, 1}]
> The numerical sum is the truncated definition of the LerchPhi function
> (which converges very well). For negativ v you shall see a huge error.
> It took me some time to find this out. Isn't it just wonderfull that we
> serve as beta testers for Wolfram and we shall never get a free bug fix
> (if there shall ever be any bug fix at all...)? Imagine that I paid money
> for this super-buggy product.
> Best regards
> Kai Koehler

Although there is indeed a bug within these examples, the above
characterization of the bug is not correct, or at least it is not
complete.  I would like to provide a (hopefully) useful description
of this bug.

There are at least two common definitions for LerchPhi[z, s, a]:

    Sum[z^n/(a+n)^s, {n,0,Infinity}]

    Sum[z^n/((a+n)^2)^(s/2), {n,0,Infinity}]

The sum Sum[Exp[-k]/(1+k^3), {k,0,Infinity}], and the documentation,
use the first definition.

Numerical evaluation of LerchPhi[z, s, a] uses the second definition.

The bug is that Mathematica uses the first definition in some places,
and the second definition in other places.

If you use the first definition to compute numerical approximations
for the result from Sum[Exp[-k]/(1+k^3), {k,0,Infinity}], you will
get a correct result:

In[1]:= A = Sum[Exp[-k]/(1+k^3), {k,0,Infinity}];

In[2]:= A /. LerchPhi[z_, s_, a_] :>
                    NSum[z^k/(a + k)^s, {k, 0, Infinity}] //Chop

Out[2]= 1.20111

If you use the second definition you will get agreement with
numerical evaluation of LerchPhi[z, s, a]:

In[3]:= Block[{z = 0.4, v = -0.5},
            {NSum[z^n/((n + v)^2)^(1/2), {n, 0, 20}], LerchPhi[z, 1, v]}]

Out[3]= {2.94299, 2.94299}

We apologize for our part in any difficulties caused by this conflict.
For reliable information about this or other similar concerns, please
contact the technical support group at Wolfram Research.

Dave Withoff
Wolfram Research

  • Prev by Date: announcement: new Plane Tiling package
  • Next by Date: Re: Re: Useful Dumb User Questions
  • Previous by thread: Mathematica 3.0.0 bug in LerchPhi function
  • Next by thread: Re: Mathematica 3.0.0 bug in LerchPhi function