Post Reply 
Natural logarithm of 2 [HP-15C/HP-42S/Free42 & others]
11-08-2019, 03:18 PM (This post was last modified: 11-09-2019 02:29 AM by Albert Chan.)
Post: #15
RE: Natural logarithm of 2 [HP-15C/HP-42S/Free42 & others]
Using Pi and AGM to get log(2): see http://rnc7.loria.fr/brent_invited.pdf, page 32

\(\large log(2^n) = \frac{\pi/2}{AGM(1, \frac{4}{2^n})} \left(1 + O(\frac{1}{2^{2n}}) \right)\)

Big enough n so that error term may be ignored. Assume O(1/4^n) = 1/4^n :

1/4^n < 1e-12
n ≥ 12 / log10(4) ≥ 19.93

Casio FX-115MS, with n = 20:

A=1
B=2^-18
C=A+B : B=√AB : A=C/2 : A-B

====     → 0.4980487824
====     → 0.2197274566
====     → 0.0525527223
====     → 0.0030466068
====     → 0.0000102395
====     → 0.0000000001

Convergence close to quadratic. With final A,B, we have

log(2) ≈ pi/(n(A+B)) = 0.693147180558, under-estimated 2e-12

Update: More precise calculations shows that n=20 over-estimated log(2) by 2e-12
Below suggested relative error term O(1/4^n) ≈ 1/4^(n-1)

python> from gmpy2 import *
python> f = lambda n: const_pi() / (2 * n * agm(1, 4/2**n))
python> for n in range(20, 25): print n, "%.15g" % f(n)
...
20 0.693147180562285
21 0.693147180560532
22 0.693147180560093
23 0.693147180559982
24 0.693147180559955
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Natural logarithm of 2 [HP-15C/HP-42S/Free42 & others] - Albert Chan - 11-08-2019 03:18 PM



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