0
$\begingroup$

This question already has an answer here:

I can't seem to implement IntegerListPlot, or find anything about it in the documentation. I can only assume it a custom function.

It comes from this link. I downloaded the Mathematica notebook, but can't seem to replicate the plot. Here is the code used:

RiemannFSum[x_?NumericQ] := Total[PrimePi[x^(1/#)]/# & /@ Range[Floor[Log[2, x]]]]

Show[Block[{$DisplayFunction = Identity}, {IntegerListPlot[PrimePi[Range[50]], 
PlotStyle -> Black], IntegerListPlot[RiemannFSum /@ Range[50]]}], AxesLabel ->
TraditionalForm /@ {x, {StyleForm[HoldForm[f[x]], FontColor -> Red], 
StyleForm[PrimePi[x], FontColor -> Black]}}]

which should generate this:

enter image description here

For me though, it just generates an error message. Using ListPlot works, but is not the desired result:

enter image description here

Am I missing something?

$\endgroup$

marked as duplicate by Mike Honeychurch, Sjoerd C. de Vries, Artes, Dr. belisarius, rm -rf Nov 21 '13 at 2:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2
$\begingroup$

This will work! Please have a look at DiscretePlot in the doc.

RiemannFSum[x_?NumericQ] := Total[PrimePi[x^(1/#)]/# & /@ Range[Floor[Log[2, x]]]];
With[{int = Range[50]},ListLinePlot[{RiemannFSum /@ int, PrimePi[int]},
     InterpolationOrder -> 0, PlotStyle -> {Red, Black},AxesLabel ->
     (TraditionalForm /@ {x,Row@{StyleForm[HoldForm[f[x]], FontColor -> Red], ",", 
        StyleForm[PrimePi[x], FontColor -> Black]}})]]

enter image description here

$\endgroup$
  • $\begingroup$ Many thanks for your solution - works great :) $\endgroup$ – martin Nov 20 '13 at 10:20
1
$\begingroup$

Why don't you use the answer that Sjoerd C. de Vries gave you?

intplot[f_, max_, min_: 1] := Riffle[Table[{x, f[x]}, {x, min, max}], 
                                     Table[{x + 1, f[x]}, {x, min, max}]];

RiemannFSum[x_?NumericQ] := Total[PrimePi[x^(1/#)]/# & /@ Range[Floor[Log[2, x]]]]


ListPlot[{intplot[RiemannFSum, 50], intplot[PrimePi, 50]}, Joined -> True]

enter image description here

$\endgroup$
  • $\begingroup$ Yes, I have just realised that I could have applied that principle here :o $\endgroup$ – martin Nov 20 '13 at 10:20

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