MathGroup Archive 2008

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

Search the Archive

Troubles with HarmonicNumber, empty sums, and Zeta

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85519] Troubles with HarmonicNumber, empty sums, and Zeta
  • From: "David W.Cantrell" <DWCantrell at sigmaxi.net>
  • Date: Wed, 13 Feb 2008 04:15:49 -0500 (EST)

Some inconsistencies with HarmonicNumber, empty sums, and Zeta are
mentioned. (I'm using version 6.0.1 under Windows.)

1.  Compare

In[2]:= HarmonicNumber[z, 0]
Out[2]= z

which agrees with the sixth statement at
<http://functions.wolfram.com/GammaBetaErf/HarmonicNumber2/03/01/01/>, with

In[3]:= HarmonicNumber[-1, 0]
Out[3]= 0

rather than -1. Clearly there is an inconsistency.

As another example of this sort of inconsistency:

In[4]:= HarmonicNumber[z, -2]
Out[4]= z/6 + z^2/2 + z^3/3
In[5]:= % /. z -> -4
Out[5]= -14

In[6]:= HarmonicNumber[-4, -2]
Out[6]= 0

It seems that, in the current implementation, HarmonicNumber[n, x] is
always intended to be 0 when n is a nonpositive integer. This makes sense
if one looks at the second primary definition at
<http://functions.wolfram.com/GammaBetaErf/HarmonicNumber2/02/> and thinks
of it as being valid for n any integer (rather than, as stated, any natural
number). It would make sense then because, if n is a nonpositive integer,
the sum would normally be understood to be empty, and hence have value 0,
regardless of the summand.

2.  Although I said that it seems that, in the current implementation,
HarmonicNumber[n, x] is always _intended_ to be 0 when n is a nonpositive
integer, I do know of two exceptions.

a.  When the second argument is 1, the result is ComplexInfinity. For
example,

In[9]:= HarmonicNumber[-2, 1]
Out[9]= ComplexInfinity

I suspect that is a bug.

b.  When the second argument is E (or Pi, etc.), we clearly have a bug:

In[11]:= HarmonicNumber[-5, E]
Out[11]= Zeta[E] - System`HarmonicNumberDump`ZetaClassical[E, -4]

3.  Concerning empty sums themselves, note that

In[16]:= Clear[x]; Sum[x, {i, 1, -4}]
Out[16]= 0

Indeed, Sum[x, {i, 1, n}] yields 0 if n is any specific nonpositive
integer, and that is as I think it should be. But

In[18]:= Sum[x, {i, 1, n}]
Out[18]= n x

and obviously, if n is a negative integer (and x is nonzero), then we have
an inconsistency because n x would not be 0. I really do not know how -- or
even, if -- this inconsistency should be dealt with. One general
possibility, but probably not a good suggestion, would be to have
Sum[expr, {i, m, n}]  return
UnitStep[n - m]*(whatever the sum currently returns).

4.  Finally, I'll note that the first primary definition given at the
previous link, namely,

HarmonicNumber[z, r] == Zeta[r] - Zeta[r, z + 1]

does not always hold in Mathematica. For example,

In[26]:= HarmonicNumber[-3, -1/2]
Out[26]= 0

while

In[27]:= N[Zeta[-1/2] - Zeta[-1/2, -2]]
Out[27]= -2.41421

[BTW, is there some reasonably direct way to simplify
Zeta[-1/2] - Zeta[-1/2, -2]  to  -1 - Sqrt[2]  using Mathematica?]

David W. Cantrell


  • Prev by Date: Re: Import syntax question
  • Next by Date: Re: Import syntax question
  • Previous by thread: Help with NMinimize of NIntegrate function
  • Next by thread: Re: Troubles with HarmonicNumber, empty sums, and Zeta