Post Reply 
Ln(x) using repeated square root extraction
03-09-2022, 07:47 PM
Post: #13
RE: Ln(x) using repeated square root extraction
Instead of reducing argument, √...√x, we can blow it up, and get log from AGM

From Series[EllipticK[1-(4x)^2], {x,0,4}], and ignored imaginery parts:

K(m=1-(4/x)^2) = log(x) + (log(x)-1)*(4/x^2) + O(1/x^4)

lua> x = 2^14
lua> a, b = 1, 4/x
lua> c = b/x
lua> for i=1,6 do a,b = (a+b)/2, sqrt(a*b); print(a,b) end
Code:
0.5001220703125         0.015625
0.25787353515625        0.08839913658307309
0.17313633586966154     0.15098277337311447
0.162059554621388       0.16168056210089243
0.1618700583611402      0.16186994744240293
0.16187000290177156     0.16187000290176207

AGM have quadratic convergence.
With 6 sqrt, (a,b) already close enough so that (a+b)/2 ≈ AGM

lua> k = pi/(a+b)
lua> k / 14
0.6931471898242749
lua> (k+c)*(1-c) / 14
0.6931471805599455
lua> log(x) / 14 -- = log(2)
0.6931471805599453

Note: if c=4/x^2 small enough, below machine epsilon, log(x) = k, no need for correction.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Ln(x) using repeated square root extraction - Albert Chan - 03-09-2022 07:47 PM



User(s) browsing this thread: 1 Guest(s)