Message Boards Message Boards

Using AnglePath to compute partial sums of Riemann Zeta Dirichlet Series

Posted 5 years ago

Recently I was using WolframCloud to visualize the partial sums of the Dirichlet series underlying the Riemann Zeta function (also known as a p-Series), using Table and Accumulate and feeding the result to ComplexListPlot. At some point I realized that the partial sum coordinates could be represented as an AnglePath, as the lengths and angles of the segments followed a regular pattern based on the real and imaginary components of the input value. I discovered that this method is much faster than the complex exponentiation I was previously doing, enabling me to generate a visualization of thousands of partial sums within seconds.

I figured I would share the function I wrote here in case anyone else finds it useful:

FastZetaPartialSums[s_, count_] := AnglePath[
  {1, 0}, (* starting point, as the first partial sum is always 1 + 0I *)
  Table[{
    n^-Re[s],         (* step length *)
    Im[s]Log[1 - 1/n] (* angle *)
  }, {n, 2, count}]
]

As an example, here's the image generated by running the following code:

ListPlot[
  FastZetaPartialSums[ZetaZero[1, 33704], 6000],
  PlotRange -> {{-3, 3}, {-3, 3}},
  AspectRatio -> 1
]

Zeta Image

POSTED BY: Matt Diamond
2 Replies
Posted 5 years ago

The AnglePath[] solution is quite cute, but it seems to me that a simple-minded Accumulate[] suffices:

AbsoluteTiming[s1 = FastZetaPartialSums[N[ZetaZero[1, 33704]], 1*^4];]
   {0.0095317, Null}

AbsoluteTiming[s2 = ReIm[Accumulate[Range[1*^4]^(-N[ZetaZero[1, 33704]])]];]
   {0.0024945, Null}

Norm[s1 - s2, ?]
   1.37802*10^-9

ListPlot[s2, AspectRatio -> Automatic, Frame -> True, PlotRange -> All]

curlicue

POSTED BY: J. M.
Posted 5 years ago

I had tried doing that but it was taking forever to finish processing (if it finished at all). However, I wasn't passing the ZetaZero value through N[], as I didn't think that was necessary. It looks like that function makes a big difference (your solution with Accumulate doesn't work without it)... is it all just a matter of limiting precision?

Without using N[], AnglePath runs in ~3.5 seconds while Accumulate appears to time out, though the difference in precision may not be worth it (the norm of the difference is only 2.96717*^-9).

POSTED BY: Matt Diamond
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract