Post Reply 
Natural logarithm of 2 [HP-15C/HP-42S/Free42 & others]
10-13-2019, 01:56 AM (This post was last modified: 10-13-2019 04:18 PM by Albert Chan.)
Post: #11
RE: Natural logarithm of 2 [HP-15C/HP-42S/Free42 & others]
Here is HP-71B code to calculate log(2)

Line 10: the code actually do log(8), with guess = 2
Line 20: Y = SINH(X-2) ≈ (X-2) + (X-2)^3/3! + (X-2)^5/5! + (X-2)^7/7!
Line 30: Y = EXP(2) * EXP(X-2) = EXP(X)
Line 40: cubically convergent iterations for LOG(N)

Code:
10 N=8 @ X=2 @ E2=EXP(2)
20 Y=X-2 @ Z=Y*Y @ Z=Z/6*(1+Z/20*(1+Z/42)) @ Y=Y+Y*Z
30 Y=E2*(Y+SQRT(1+Y*Y))
40 Z=2*(Y-N)/(Y+N) @ X=X-Z
45 PRINT X/3
50 IF ABS(Z)>.0001 THEN 20

>RUN
.69313326289
.69314718056

Ref: http://rnc7.loria.fr/brent_invited.pdf, page 20
Ref: https://pdfs.semanticscholar.org/2db2/10...5e12fe.pdf
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 - 10-13-2019 01:56 AM



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