# Problem with plotting (resp. expanding) the Hurwitz Zeta function

I expected the two plots to be identical. Can anyone confirm that the discrepancies show a bug?

b[s_, v_] := If[s == 0, 1, -s*Zeta[1 - s, v]];

Table[Expand[FullSimplify[b[n, x]]], {n, 1, 6}]
Plot[%, {x, -1, 3/2}, PlotRange -> {-1, 1}]

Table[BernoulliB[n, x], {n, 1, 6}]
Plot[%, {x, -1, 3/2}, PlotRange -> {-1, 1}]

• It seems that not all identical. b[s_, v_] := If[s == 0, 1, -s*Zeta[1 - s, v]]; funs1 = Table[Expand[FullSimplify[b[n, x]]], {n, 1, 6}] // FunctionExpand; funs2 = Table[BernoulliB[n, x], {n, 1, 6}]; Grid[{funs1, funs2}, Frame -> All] Commented Jun 21, 2021 at 8:20
• @cvgmt Yes, but that's exactly the problem!
– Carl
Commented Jun 21, 2021 at 8:30
• From the Mathematica documentation, "Zeta[s] gives the Riemann zeta function [Zeta](s)" and "Zeta[s, a] gives the generalized Riemann zeta function [Zeta](s, a)" and "HurwitzZeta[s, a] gives the Hurwitz zeta function [Zeta](s, a)". MathWorld states that there are two different forms of the Hurwitz zeta function, one implemented as HurwitzZeta[s, a], the other as Zeta[s, a] and the two are identical only for Re[a] > 0. Commented Jun 21, 2021 at 14:46
• @Bob, see my comment on my answer. The sentence there was taken over literally from MathWorld.
– Carl
Commented Jun 21, 2021 at 14:54
• As were the statements in my comment. MathWorld is telling you that there are two conventions, it is up to you to ensure that you are using the appropriate convention (and Mathematica implementation) for your particular use. Commented Jun 21, 2021 at 15:03

And the solution is: use HurwitzZeta instead of Zeta.

b[s_, v_] := If[s == 0, 1, -s*HurwitzZeta[1 - s, v]];
V := Table[FunctionExpand[FullSimplify[b[n, x]]], {n, 1, 6}];
W := Table[BernoulliB[n, x], {n, 1, 6}];
Grid[{V, W}, Frame -> All]


oh well ...

• According to MathWorld: "The Hurwitz zeta function is implemented in the Wolfram Language as Zeta[s, a]." ??
– Carl
Commented Jun 21, 2021 at 11:15

Perhaps a partial answer: According to Mathworld, Eq. 9, the comparison should be:

bs = Table[-BernoulliB[n + 1, x]/(n + 1), {n, 1, 6}]


and

zs = Table[Zeta[-n, x], {n, 1, 6}]


which appear to be the same when x>0:

Plot[bs, {x, 0, 3/2}]


and

Plot[zs, {x, 0, 3/2}]


but not when x < 0

Plot[bs, {x, -1, 0}]


and

Plot[zs, {x, -1, 0}]


but note that:

With[{abs = Abs[bs]}, Plot[abs, {x, -1, 0}]]


appears to be the same, but for n=1

• What you say in the first part is exactly the same only with one factor shifted from one side to the other. For the second part: BernoulliB[n, x] are the functions against which the representation is to be validated, not to any others.
– Carl
Commented Jun 21, 2021 at 10:26