Dirichlet coefficients as limits: wrong

Perhaps I should have included the word "bug" in my question. Here we go

There is a bug in this Limit

Limit[3^s (-1 - 2^-s + Zeta[s]), s -> ∞]
(* 0 *)


which should be 1.

But I withdraw herewith (16 July, 2015) my former statement (8 July, 2015) that there is a bug in a specific Series[].

More elaboration below.

Trying to calculate coefficients of a Dirichlet series $f(s)=\sum _{n=1}^{\infty } a( n) n^{-s}$ using Limit[] reveals a strange behaviour of Mathematica 10.1

Here's a simple example.

Let

f[s_]:=Zeta[s]


and

b[n_, s_] := n^s (f[s] - Sum[1/k^s, {k, 1, n - 1}])


then we would expect to get the first four Dirichlet coefficients from

{Limit[Zeta[s], s -> ∞],
Limit[2^s (-1 + Zeta[s]), s -> ∞],
Limit[3^s (-1 - 2^-s + Zeta[s]), s -> ∞],
Limit[4^s (Zeta[s] - 1 - 2^-s - 3^-s), s -> ∞]}


But the output is

(*
{1, 1, 0, -∞}
*)


The first two limits are ok, the third and fourth limits are wrong, as they must be 1 as well.

On the other hand, plotting b[n,s] shows that the limits are 1.

What's going on here?

Remark:
The standard procedure to calculate the Dirichlet coeffients of a given function f(s) employs this formula

a[n_]:= n^σ Limit[(1/(2 T)
Integrate[f[σ + I t] n^(I t), {t, -T, T}]),
T -> ∞]


But I wanted to take a seemingly simpler approach.

Expansion of Dirichlet series with the function Series[]

It is interesting to study the expansion of a Dirichlet series with the function Series[], and especially about the point about s = ∞. I shall confine the explication here to the case of the famous Riemann zeta function.

The documentation of Series[] points out as an issue:

Some functions cannot be decomposed into series of power-like functions:

Series[Zeta[s], {s, \[Infinity], 10}]

(*
Out[26]= 1 + 2^-s + 3^-s + 4^-s + 5^-s + 6^-s + 7^-s + 8^-s + 9^-s + 10^-s
*)


Now consider this limit for various numbers n of expansion terms

Table[{n, Limit[Series[2^s (Zeta[s] - 1), {s, \[Infinity], n}] // Normal,
s -> \[Infinity]]}, {n, 0, 3}]

(*
Out[36]= {{0, 0}, {1, 0}, {2, 1}, {3, 1}}
*)


That is, if we wish to collect terms up to s^k we need to Series[] expand up to ar least k. Sorry for pointing out "trivialities", but we are not dealing with well known power series here.

The next example show the importance of this rule more drastically

Table[{n, Limit[
Series[3^s (Zeta[s] - 1 - 2^-s), {s, \[Infinity], n}] // Normal,
s -> \[Infinity]]}, {n, 0, 5}]

(*
Out[38]= {{0, -\[Infinity]}, {1, -\[Infinity]}, {2, 0}, {3, 1}, {4, 1}, {5, 1}}
*)

• To help with diagnostics: try expanding the expressions you have as a series at infinity. Jul 8, 2015 at 9:17
• @J.M.: Ok I'll add it. I did that already for myself before posting hoping to get some insight. But see for yourself. Jul 8, 2015 at 9:22
• I only have gedanken Mathematica at the moment, which is why I was asking you to try it for me… :) Jul 8, 2015 at 9:26
• I get the same results in Mathematica version 8. @J.M. I also tried Gedanken Mathematica version 8, but it crashed my kernel...
– Jens
Jul 9, 2015 at 22:57
• Bug fixed in 10.4 (not sure if it had been fixed in an earlier version) Mar 26, 2016 at 4:08

I have found a simple method to mitigate the limit bug: using an intermediate Series[], the Dirichlet coefficients of a function f[x] can be calculated correctly as a Limit[].

The formulas for the coefficients are

cD := Module[{},
a[1] = Limit[f[x], x -> ∞];
a[n_] :=
a[n] = Limit[
Series[n^x (f[x] - Sum[a[k] k^-x, {k, 1, n - 1}]), {x, ∞,
n}] // Normal, x -> ∞]]


Example 1: Zeta[x]

ClearAll[f, a]
f[x_] := Zeta[x]
cD
t = Table[{n, a[n] }, {n, 1, 10}]

(*
Out[41]= {{1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}, {6, 1}, {7, 1}, {8, 1}, {9, 1}, {10, 1}}
*)


Example 2: 1/Zeta[x]

ClearAll[f, a]
f[x_] := 1/Zeta[x]
cD
t = Table[{n, a[n], MoebiusMu[n] }, {n, 1, 10}]

(*
Out[45]= {{1, 1, 1}, {2, -1, -1}, {3, -1, -1}, {4, 0, 0}, {5, -1, -1}, {6, 1, 1}, {7, -1, -1}, {8, 0, 0}, {9, 0, 0}, {10, 1, 1}}
*)


Example 3: Zeta[2 x]/Zeta[x]

ClearAll[f, a]
f[x_] := Zeta[2 x]/Zeta[x]
cD
t = Table[{n, a[n] , LiouvilleLambda[n]}, {n, 1, 10}]

(*
Out[50]= {{1, 1, 1}, {2, -1, -1}, {3, -1, -1}, {4, 1, 1}, {5, -1, -1}, {6, 1, 1}, {7, -1, -1}, {8, -1, -1}, {9, 1, 1}, {10, 1, 1}}
*)


Example 4: DirichletEta[x]

ClearAll[f, a]
f[x_] := DirichletEta[x]
cD
t = Table[{n, a[n] }, {n, 1, 10}]

(*
Out[9]= {{1, 1}, {2, -1}, {3, 1}, {4, -1}, {5, 1}, {6, -1}, {7, 1}, {8, -1}, {9, 1}, {10, -1}}
*)


Example 5: RamanujanTauL[x] not applicable

ClearAll[f, a]
f[x_] := RamanujanTauL[x]


Method not applicable because both

Limit[RamanujanTauL[x], x -> ∞]

(*
Out[19]= Limit[RamanujanTauL[x], x -> ∞]
*)


and

Series[RamanujanTauL[x], {x, ∞, 2}]

(*
Out[20]= RamanujanTauL[x]
*)


Are returned unevaluated.

Observations

1) This method to calculate the Dirichlet coefficients is limited by the ressources of the machine and those of Mathematica.

2) Cross reference What are the terms of the sequence generated by Zeta(3s)/Zeta(s)? (March 19, 2015) Here I have used the naive limit approach for the first time.

• Does your approach work on DirichletEta[] and RamanujanTauL[]? Jul 16, 2015 at 9:04
• @J.M.: I have included these examples in my answer. Jul 16, 2015 at 10:27
• Wunderbar! Danke! Jul 16, 2015 at 10:32
• My pleasure ! . Jul 16, 2015 at 13:01
• I have revised my original question. Jul 16, 2015 at 13:41