Post Reply 
Natural logarithm of 2 [HP-15C/HP-42S/Free42 & others]
12-08-2022, 01:41 PM (This post was last modified: 12-08-2022 03:23 PM by Albert Chan.)
Post: #39
RE: Natural logarithm of 2 [HP-15C/HP-42S/Free42 & others]
Based from [VA]SRC012C
(12-01-2022 08:27 AM)Werner Wrote:  Using the original asymptotic series H(n) = ln(n) + gamma + 1/(2*n) - 1/(12*n^2) + 1/(120*n^4) - ...
results in: H(n-1)-H(n/2-1) - ln(2) = 1/(2n) + 1/(4n^2) - 1/(8n^4) + 1/(4n^6) - 17/(16n^8) + ..

Sum a shell of b-bits integer reciprocals, subtract RHS, we have estimate for ln(2)
Example: for 2-bits integer, 2 and 3:

1/2 + 1/3 - 1/8 - 1/64 + 1/2048 - 1/16384 + 17/1048576 = 2180467/3145728 ≈ 0.693151791890462

Add 1 more asymptote term for good measure, we have:

CAS> LN2(b) := sum(1/k,k,2^(b-1),2^b-1) - horner([7936,-272,16,-2,1,1/2^(b+1)],1/2^(2b+2))

CAS> LN2(2)

8721775/12582912 ≈ 0.69314440091451

CAS> LN2(3)

312589669081/450971566080 ≈ 0.693147179539803

CAS> LN2(4)

27463878294130001/39622001018535936 ≈ 0.693147180559656

Double the bits, we doubled number of correct digits.
OTTH, double the bits required squaring of number of terms, so this is not efficient.

Update: above off by factor of 2, but conclusion still hold.

2^(2b-1) = (2^(b-1))^2 * 2
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 - 12-08-2022 01:41 PM



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