cino hilliard on Mon, 12 Jan 2004 05:06:19 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Logrithmic Integral, Pi(x) |
GP/PARI CALCULATOR Version 2.2.7 (development CHANGES-1.844) i686 running cygwin (ix86 kernel) 32-bit version compiled: Oct 28 2003, gcc-3.3.1 (cygming special) (readline v4.3 enabled, extended help available) Hi Karim,Recently I had a need for the Logrithmic Integral. I could not find it in Pari. Here is my rendition. I am assuming Euler() is similar to the Euler2() below which has the zeta function. It seems to be working ok at least compared to Maple. Can you implement an Li, Ei function?
It is interesting to note that Li2(x) approximates Pi(x) more closely than Li(x) in absolute value when m = log(log(x)). Also A fast Pi(x) would be welcome. My thinking is an optional file based list of Pi(x) generated on request and then read by the interpreter. This brings to mind a prior post I made asking why can't Pari script read directly from a file vs loading it into the environment?
\\ From Methematical Handbook for Scientists and Engineers G Korn and T Korn,c 1968, \\Integral Tables page 969, Int(dx/log(x)) = log(log(x) + log(x) + log(x)^2/2/2! + \\ log(x)^3/3/3! +...
\\ I added Euler() to agree with Mathematica et al. Li2(n,m) = { y2 = log(n); y = 1; s=log(y2)+ Euler(); for(x=1,floor(2*log(n)+m),y=y2^x/x/gamma(x+1); \\ nesting vs exponentiation here would improve speed s+=y; ); return(s) } http://numbers.computation.free.fr/Constants/constants.html \\Fast convergent Euler-Mascheroni constant from above link Euler2(n) = { 1 - log(3/2) - sum(k=1,n,(zeta(k+k+1)-1)/(k+k+1)/4^k); } Thanks, Cino _________________________________________________________________Let the new MSN Premium Internet Software make the most of your high-speed experience. http://join.msn.com/?pgmarket=en-us&page=byoa/prem&ST=1