       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:= HarmonicNumber[z, 0]
Out= z

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

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

rather than -1. Clearly there is an inconsistency.

As another example of this sort of inconsistency:

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

In:= HarmonicNumber[-4, -2]
Out= 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:= HarmonicNumber[-2, 1]
Out= ComplexInfinity

I suspect that is a bug.

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

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

3.  Concerning empty sums themselves, note that

In:= Clear[x]; Sum[x, {i, 1, -4}]
Out= 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:= Sum[x, {i, 1, n}]
Out= 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

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

does not always hold in Mathematica. For example,

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

while

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

[BTW, is there some reasonably direct way to simplify
Zeta[-1/2] - Zeta[-1/2, -2]  to  -1 - Sqrt  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