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 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. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)