Re: Mathematica 3.0.0 bug in LerchPhi function
- To: mathgroup at smc.vnet.net
- Subject: [mg9190] Re: [mg9065] Mathematica 3.0.0 bug in LerchPhi function
- From: koehler at REMOVE-THIS.math.uni-bonn.de (Kai Koehler)
- Date: Tue, 21 Oct 1997 02:03:03 -0400
- Organization: RHRZ - University of Bonn (Germany)
- Sender: owner-wri-mathgroup at wolfram.com
In article <61uhb4$8ca at smc.vnet.net>, David Withoff <withoff at wolfram.com> wrote: > > 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}] > 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} Thanks once more to Dave Withoff for the fast clarification of the problem. Still there is a point which should be dealt with: There is no such thing like a second "common" definition of the Lerch Phi function. Lerch in his article in Acta Mathematica XI (p. 19-24) gives the first definition (already in the title of his paper). This is also the definition which one finds in the usual textbooks and formula collections like Whittaker-Watson or Gradshteyn-Ryzhik. The second definition does not verify the functional relations of the Lerch Phi function. Furthermore, it has a branching point of order two in the variable a in contrast to the correct definition, which is meromorphic in a and has no branching point at all. It is a very strange idea to complicate matters by artificially creating a branching point in a meromorphic function in a program like Mathematica which has traditionally lots of problems with branching points and Riemann surfaces. I have been told by Dave Withoff that the Hurwitz zeta function is evaluated in Mathematica 3.0 in the same wrong way, namely as Sum[1/((k + a)^2)^(s/2), {k, 0, Infinity}]. I want to emphasize once more that Wolfram should provide free bug fixes for serious problems like these. Also, Wolfram should officially inform its customers about these errors, e.g. on their web page. Best regards Kai Koehler