1
$\begingroup$

All:

I tried to reproduce the results from this page: How to plot the Riemann-Zeta zero spectrum

The following is the code that was posted on above page:

Clear[f]
scale = 1000000;
f = ConstantArray[0, scale];
f[[1]] = N@MangoldtLambda[1];
Monitor[Do[f[[i]] = N@MangoldtLambda[i] + f[[i - 1]], {i, 2, scale}], i]

xres = .002;
xlist = Exp[Range[0, Log[scale], xres]];
tmax = 60;
tres = .015;
Monitor[errList = Table[(xlist^(-1/2 + I t).(f[[Floor[xlist]]] - xlist)), 
  {t, Range[0, 60, tres]}];, t]

ListLinePlot[Im[errList]/Length[xlist], DataRange -> {0, 60}, 
  PlotRange -> {-.09, .02}, Frame -> True, Axes -> False]

When I tried to run above code, the 5th line:

Monitor[Do[f[[i]] = N@MangoldtLambda[i] + f[[i - 1]], {i, 2, scale}], i]

Will give me the following error:

Set::partw: Part 3 of ConstantArray[MangoldtLambda[1.], [LeftSkeleton]14\ [RightSkeleton][1.] + [LeftSkeleton]1[RightSkeleton]] does not exist.

then I tried to work around this issue by replacing the line with:

f = N[Accumulate[Table[MangoldtLambda[i], {i, 1, scale}]], 10];

The program still could not finish, it fails at line:

Monitor[errList = Table[(xlist^(-1/2 + I t).(f[[Floor[xlist]]] - xlist)), {t, Range[0, 60, tres]}];, t]

and will not generate any result, can anyone help ?

$\endgroup$
  • $\begingroup$ @Heike's code work like a charm here (Mathematica v9) $\endgroup$ – Dr. belisarius Sep 23 '15 at 13:47
  • $\begingroup$ Thank you. Yes, the problem I had with Mathematica v5. Let me see how to re-write with Table. $\endgroup$ – jim.shaw Sep 23 '15 at 14:30
2
$\begingroup$

This is really not a specific answer to the question, but one way to illustrate evolution of the zeta zeros from the primes is to evaluate the real part of formula (1) below along the critical line.

(1) $\int_{2-\epsilon}^{N+\epsilon}\frac{d\,(\text{J}(x)-\text{li}(x))}{dx}x^{-s}dx\approx\sum _{n=1}^N \text{If}\left[\text{PrimePowerQ}[n],\frac{n^{-s}}{\Omega (n)},0\right]-\text{Ei}((1-s) \log (N))+\text{Ei}((1-s) \log (\text{2}))$

The following plot illustrates the real part of formula (1) evaluated along the critical line using an evaluation limit of $N=1000$. Formula (1) is illustrated in blue, and $\Re\left(\log\zeta\left(\frac{1}{2}+i\,t\right)\right)$ is illustrated in orange as a reference. The red discrete portion of the plot illustrates the evaluation of formula (1) at the first 10 zeta zeros.

Formula (1) evaluated at $N=1000$

Another approach which is more closely related to the question is to evaluate formula (2) below.

(2) $\quad 2\sum_{n=1}^N\text{MangoldtLambda}\,[n]\,n^{-\frac{1}{2}}\,\text{Cos}\,[\,\text{Log}\,[n]\,t]$

The following plot illustrates formula (2) with an evaluation limit of $N=1000$. The red discrete portion of the plot illustrates the evaluation of formula (2) at the first 10 zeta zeros.

Formula (2) evaluated at $N=1000$

Formula (2) diverges as $N\to\infty$ (the oscillation in the corresponding plot grows in both magnitude and frequency as $N$ increases), but at finite evaluation limits formula (2) illustrates evolution of the zeta zeros from the primes.

$\endgroup$
1
$\begingroup$

After removing typos due to line breaks this code runs fine (for about 1 minute) and produces a nice Picture.

For completeness: Version 10.1.0

Source: https://stackoverflow.com/questions/8934125/how-plot-the-riemann-zeta-zero-spectrum-with-the-fourier-transform-in-mathematic, user Heike, Jan 23 '12 at 17:15

Clear[f] 
scale = 1000000;
f = ConstantArray[0, scale];
f[[1]] = N@MangoldtLambda[1];

Monitor[Do[f[[i]] = N@MangoldtLambda[i] + f[[i - 1]], {i, 2, scale}],i] ;

xres = .002;
xlist = Exp[Range[0, Log[scale], xres]]; tmax = 60; tres = .015;

Monitor[errList = 
   Table[(xlist^(-1/2 + I t).(f[[Floor[xlist]]] - xlist)), {t, 
     Range[0, 60, tres]}];, t] ; 

ListLinePlot[
 Im[errList]/Length[xlist], DataRange -> {0, 60}, 
 PlotRange -> {-.09, .02}, Frame -> True, Axes -> False]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.