## Does logint function work well? (for PNT)

### Notae (view profile)

on 13 Oct 2018
Latest activity Commented on by Notae

on 19 Oct 2018

### David Goodmanson (view profile)

On the 'Prime Obsession' book, 20 to the power 1/2 + 14.134725i is −0.302303 − 4.46191i. Take the logarithmic integral—the Li function—of that to get the answer −0.105384 + 3.14749i.
I tried as belows, but failed.
>> a=20^(1/2+14.134725i)
a =
-0.3023 - 4.4619i % OK
ans =
0.9528 - 3.9138i % Wrong

Notae

### Notae (view profile)

on 14 Oct 2018
You are right. logint integral from 0 to x. Li(x) = int(1/ln(t)dt from 0 to x or from 2 to x => It's a minor problems. The result of The Book(page 340) and mine is very different. I used logint(x^a); a is first roots of zeta function, and is about 1/2+14.134725i). logint( ) works well. I tested as integral(@(x)1./log(x), 2, x)+logint(2) == logint(x). But the book cannot be wrong, the author did many trials with the Mathematica(I don't have and use).
the cyclist

### the cyclist (view profile)

on 14 Oct 2018
If you go to WolframAlpha and evaluate the expression
Li(20^(1/2+14.134725i)) - Li(2)
0.952805 - 3.91384i
which is what you say that MATLAB also gives. Therefore, I think the problem is not with MATLAB.
Maybe you could post more of what it says in the book you mention. Maybe there is some other part you are missing.
Notae

### Notae (view profile)

on 15 Oct 2018
Thank you for your efforts. I have tired to roughly understand the prime number theory and Riemann zeta function(and hypothesis). For the final error complement, all sum of Li(x^zeros of zeta function) is essential. But the number(s) is too big. With psi function, I did well, all sum of x^p/p is necessary(p is rho, zeros of zeta function)

R2018b

### David Goodmanson (view profile)

on 15 Oct 2018
Edited by David Goodmanson

### David Goodmanson (view profile)

on 15 Oct 2018

Hi Notae,
The reason for this is something that Derbyshire relegated to a footnote several pages before (p. 335, 128). If you look at the logarithmic integral, its primary definition is
Li(z) = Ei(log(z))
(Abramowitz & Stegun 5.1.3) where Ei is a particular exponential integral which Matlab does have, although that fact is not so obvious and you need the symbolic toolbox. [there is a workaround for Ei, see below]. However, there is a 2pi ambiguity when taking the log, since for any integer n, log(z) and log(z)+2*pi*i*n are equally valid answers. That means that Ei(logz)) depends on n and you have to pin down the actual angle.
If z = Ae^(i*b) where b is restricted to the range -pi<b<=pi in the first place, then Li(z) and Ei(log(z)) give the same result.
c = ei(log(2+i))
b = 1.4113 + 1.2247i
c = 1.4113 + 1.2247i
In this case, though,
a = 20^(.5+14.134725i)
and you have to keep track of the number of times you go around the circle so as to remove ambiguity.
% a = 20^(.5+14.134725i)
loga = log(20)*(.5+14.134725i)
loga = 1.4979 +42.3439i % large angle, no 2pi ambiguity
format long
ei(loga)
ans = -0.105384042414102 + 3.147487521958689i
as advertised. That's what he did in footnote 128.
If you don't have the symbolic toolbox, since expint is available in basic Matlab you can use
function y = ei_alt(z)
y = -expint(-z) + (log(z)-log(1/z))/2 - log(-z);
end
Ei(logz)) can distinguish how many times you go around the circle, but Li(z) as defined on p.114 (and generalized so that the path of integration is a straight line from 0 to complex number z) cannot. To say as he did on p. 340 that he used the Li function is highly misleading, as you found out.

Notae

### Notae (view profile)

on 18 Oct 2018
I saw it on the 'http://demonstrations.wolfram.com/HowTheZerosOfTheZetaFunctionPredictTheDistributionOfPrimes/' They say 'Ei(p*log(x), where p(rho) is the complex zero of the zeta function. In this formula, (Mathematica's built-in function ExpIntegralEi[z]) is the generalization of the logarithmic integral to complex numbers.' And I read logint(z)=ei(log(z)) by MATLAB doc. So I tried as abovee. But failed again. Anyway logint(z) works well if a input arg. is complex number. So ei(log(z)) doesn't neccessory.
Notae

### Notae (view profile)

on 19 Oct 2018
I skipped your good answer and just insisted my biased, one-way thought that I had tried all as I can including your answer. But now I read your answer one word by one, and I understand what you mean. Anyway thank you really. (But the plot of pi(x) and R(x)-R(x^p) appeared bad. The x and psi(x) (here Li(sum of x^p/p) exist) showed very good looks which was the same as many papers.)