Brent Hilpert wrote:
The other way of parsing Jerome's message is that
he wants to *use* the
reciprocal *to calculate* the log,
i.e.:
log(x) = F( 1/x )
as opposed to taking the log of the reciprocal ( log(1/x) ).
F() is a rather basic anti-derivative function in calculus, but I've
forgotton too much calculus to remember how to calculate it.
Jerome Fine replies:
First, I thank all of you who replied as I found helpful
suggestions with every reply.
What I really want to calculate is:
log(v) = log(x * 2 ** A) = log(x) + A * log(2)
where 1 =< x =< 2 then:
log(1+x) = x - x**2/2 + x**3/3 - x**4/4 ...
which converges quickly only for very small x. A faster rate
of convergence is with:
log(x) = log([1+y]/[1-y]) = 2 y (1+ y**2/3 + y**4/5 + y**6/7 ...)
where y = ( x - 1 ) / ( x + 1 )
For this algorithm, I will require 1/(x+1). Then, if x = 2,
y = 1.0 / 3.0
Since this still converges rather slowly (when at least 128 bit
accuracy is required - perhaps 50 terms are needed), for values
of x greater than about 1.125, I will likely split the range
into about 8 windows and divide (actually multiply by the
pre-calculated reciprocal) by the midpoint of each window.
If anyone wants a link for log(2), please ask!
IN ADDITION, where I really require 1/[2p+1] is for:
log(p+1) = log(p) + 2 ( 1 / [2p+1] + 1 / < 3 * [2p+1]**3 > + 1 / < 5 * [2p+1]**5
> ... )
when I want to calculate a succession of log values.
Since I want to calculate log(x) for:
x = 1.000Eyy to 9.999Eyy, I require (yy+3)*log(10) and
log(1000) to log(9999)
Finally, li(x) also requires 1/A. I hope this additional
detail clarifies my requirements.
The value of li(x) for x = 10 ** 38 is about 10 ** 36 and
I therefore require first the value of log(x) to be accurate
to at least 128 bits if the accuracy of li(x) is to be
accurate for just the integer portion. If you are interested
to do a google search under "li for prime numbers", there are
ample references including the formulae for li at:
http://mathworld.wolfram.com/LogarithmicIntegral.html
The following provides additional links:
http://www.google.ca/search?hl=en&q=logarithmic+integral&btnG=Googl…
I am still not able to figure out why the FORTRAN 77
subroutine has different timing when the destination
address is moved from PAR0 to PAR1 under RT-11 under
both E11 and a real PDP-11/73. Cache has been suggested,
so I will attempt the calculation with a PDP-11/23
which does not have any cache.
Sincerely yours,
Jerome Fine
--
If you attempted to send a reply and the original e-mail
address has been discontinued due a high volume of junk
e-mail, then the semi-permanent e-mail address can be
obtained by replacing the four characters preceding the
'at' with the four digits of the current year.