3
$\begingroup$

This should be easy, but for some reason I'm struggling. The Chebyshev psi function is given as the sum from 0 to x of the von Mangoldt function MangoldtLambda[x]. I want to tabulate it. Ideally, I'd like to express the function using Sum, but I can't find the right form. This doesn't work:

TableForm[
 Table[With[{k = 10}, Sum[N[MangoldtLambda[x], 5], {x, 0, k}]], 
 {x, 0, 10}]]

This produces a series that makes no sense at all:

TableForm[
 Table[With[{k = 10}, Sum[N[MangoldtLambda[x], 5], {k, 0, x}]], 
 {x, 0, 10}]]

Accumulate doesn't work either:

TableForm[Table[Accumulate[N[MangoldtLambda[x], 5]], {x, 0, 10}]]

Clearly I'm suffering from a failure of imagination, but I'd appreciate help.

$\endgroup$
5
$\begingroup$

There seems to be a duplicate use of the symbol x in your formulas.

ChebyshevPsi[x_] := Sum[MangoldtLambda[y], {y, x}]
Table[ChebyshevPsi[x], {x, 10}]

{0, Log[2], Log[2] + Log[3], 2 Log[2] + Log[3], 2 Log[2] + Log[3] + Log[5], 2 Log[2] + Log[3] + Log[5], 2 Log[2] + Log[3] + Log[5] + Log[7], 3 Log[2] + Log[3] + Log[5] + Log[7], 3 Log[2] + 2 Log[3] + Log[5] + Log[7], 3 Log[2] + 2 Log[3] + Log[5] + Log[7]}

You can also directly construct a list of these with Accumulate:

Accumulate@Array[MangoldtLambda, 10]

{0, Log[2], Log[2] + Log[3], 2 Log[2] + Log[3], 2 Log[2] + Log[3] + Log[5], 2 Log[2] + Log[3] + Log[5], 2 Log[2] + Log[3] + Log[5] + Log[7], 3 Log[2] + Log[3] + Log[5] + Log[7], 3 Log[2] + 2 Log[3] + Log[5] + Log[7], 3 Log[2] + 2 Log[3] + Log[5] + Log[7]}

Plot the deviation of the Chebyshev $\psi$ function from $x$:

ListLinePlot[MapIndexed[{#2[[1]], #1 - #2[[1]]} &, 
  Accumulate@Array[MangoldtLambda, 1000]], Frame -> True, 
  FrameLabel -> {x, ψ[x] - x}]

enter image description here

$\endgroup$
  • $\begingroup$ I'll tick this when it lets me! Appreciated. $\endgroup$ – Richard Burke-Ward Mar 4 at 14:39

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.