Mathematica Asked on June 7, 2021
Riemann’s prime counting function J
(link) takes half-values at every jump-discontinuity. So, I define it thus:
Clear["Global`*"];
floor[e_] := Quiet[Check[Floor[e], Floor[FullSimplify[e]]]];
riemannJ[x_] :=
With[{δ = 0.01},
Piecewise[{
{(Sum[(1/α)* PrimePi[(x - δ)^(1/α)],
{α, 1, floor[Log[x - δ]/Log[2]]}] + Sum[(1/α)*
PrimePi[(x + δ)^(1/α)], {α, 1,
floor[Log[x + δ]/Log[2]]}])/2,
PrimePowerQ[x]},
{Sum[(1/α)*PrimePi[x^(1/α)], {α, 1,
floor[Log[x]/Log[2]]}],
True}
}]];
Viewed as a Plot
, the function J[x]*x^(-s - 1)
produces a series of continuous lines that are discontinuous from each other at all points where PrimePowerQ[x] = True
(plot shown with with s = -2
):
Module[{s = -2},
Plot[riemannJ[x]*x^(-s - 1), {x, 1, 10}, GridLines -> Automatic]
]
I have a couple of problems:
That error message: is Mathematica passing inaccurate values of x
to Plot
?
I’d like to use Manipulate
to chart the curve for different values of s
. But the plot now has a pink fill. The code is:
Manipulate[
Plot[riemannJ[x]*x^(-s - 1), {x, 1, 10}, GridLines -> Automatic],
{{s, -2, Style["Choose s", Larger, Bold]}, -5, 5, 1/2},
ControlType -> Setter]
and the output:
I assume that this is the same error (as evidenced but the line below the plot), only now it shows the plot in pink.
How do I get around this?
Lastly:
PrimePowerQ
only takes exact numbers as arguments.
In[1]:= PrimePowerQ[1.2]
During evaluation of In[1]:= PrimePowerQ::exact: Argument 1.2` in PrimePowerQ is not an exact number.
Out[1]= PrimePowerQ[1.2]
Plot
is happy to ignore the unevaluated Piecewise
calls (which is why you also get the discontinuities).
All three questions are fixed by replacing PrimePowerQ[x]
with PrimePowerQ[Rationalize[x,0]]
.
Correct answer by George Varnavides on June 7, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP