Post Reply 
Log-Arcsine Algorithm
11-02-2022, 10:22 PM
Post: #1
Log-Arcsine Algorithm
Recently I stumbled upon the Log-Arcsine Algorithm in Peter Henrici's book: Computational Analysis with the HP-25 Pocket Calculator. (pp. 207)

The following recurrence relation is used:

\(
\begin{align}
s_{n+1} = s_n \sqrt{\frac{2 s_n}{s_n + s_{n-1}}}
\end{align}
\)

This little program can be used with most HP calculators:
Code:
ENTER
ENTER
+
LASTX
R↑
+
÷
SQRT
×

Example

0 ENTER 1
R/S
R/S
R/S


1.41421356237
1.53073372946
1.56072257613
1.56827424527
1.57016557848
1.57063862547
1.57075690057
1.57078647018
1.57079386264
1.57079571076
1.57079617279
1.57079628829
1.57079631717
1.57079632439
1.57079632619
1.57079632664
1.57079632676
1.57079632679
1.57079632679
1.57079632679



Let's slap a loop around it and we have yet another program for the next \(\pi\)-day:
Code:
00 { 26-Byte Prgm }
01▸LBL "pi"
02 0
03 1
04▸LBL 00
05 ENTER
06 ENTER
07 +
08 LASTX
09 R↑
10 +
11 ÷
12 SQRT
13 ×
14 X≠Y?
15 GTO 00
16 2
17 ×
18 END

This allows us to calculate both \(\log\) and \(\arcsin\) on an HP-16C:
Code:
001 - 43,22, A  LBL A      
002 -       36  ENTER      
003 -       36  ENTER      
004 -    43 26  1/x        
005 -       40  +          
006 -        2  2          
007 -       10  /          
008 -       34  x<>y       
009 -       36  ENTER      
010 -    43 26  1/x        
011 -       30  -          
012 -        2  2          
013 -       10  /          
014 -       20  x          
015 -    43 36  LSTx       
016 -    22  0  GTO 0      
017 - 43,22, b  LBL B      
018 -       36  ENTER      
019 -       36  ENTER      
020 -       20  x          
021 -        1  1          
022 -       34  x<>y       
023 -       30  -          
024 -    43 25  SQRT       
025 -       34  x<>y       
026 -       20  x          
027 -    43 36  LSTx       
028 - 43,22, 0  LBL 0      
029 -       36  ENTER      
030 -       36  ENTER      
031 -       40  +          
032 -    43 36  LSTx       
033 -    43 33  R^         
034 -       40  +          
035 -       10  /          
036 -    43 25  SQRT       
037 -       20  x          
038 -    43 34  PSE        
039 -    43  0  x!=y       
040 -    22  0  GTO 0

Examples

10
GSB A

2.302585094

0.5
GSB B

0.523598775

Here is the same program for the HP-42S:
Code:
00 { 56-Byte Prgm }
01▸LBL "log"
02 ENTER
03 ENTER
04 1/X
05 +
06 2
07 ÷
08 X<>Y
09 ENTER
10 1/X
11 -
12 2
13 ÷
14 ×
15 LASTX
16 GTO 00
17▸LBL "asin"
18 ENTER
19 X↑2
20 1
21 X<>Y
22 -
23 SQRT
24 X<>Y
25 ×
26 LASTX
27▸LBL 00
28 ENTER
29 ENTER
30 +
31 LASTX
32 R↑
33 +
34 ÷
35 SQRT
36 ×
37 X≠Y?
38 GTO 00
39 END

References
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Log-Arcsine Algorithm - Thomas Klemm - 11-02-2022 10:22 PM
RE: Log-Arcsine Algorithm - Nihotte(lma) - 11-03-2022, 06:32 PM
RE: Log-Arcsine Algorithm - Albert Chan - 11-04-2022, 03:29 PM
RE: Log-Arcsine Algorithm - Albert Chan - 11-04-2022, 04:58 PM
RE: Log-Arcsine Algorithm - Albert Chan - 11-05-2022, 10:47 AM
RE: Log-Arcsine Algorithm - Thomas Klemm - 11-05-2022, 01:27 AM
RE: Log-Arcsine Algorithm - Albert Chan - 11-06-2022, 12:09 PM
RE: Log-Arcsine Algorithm - Thomas Klemm - 11-05-2022, 11:18 PM
RE: Log-Arcsine Algorithm - Thomas Klemm - 11-06-2022, 02:43 PM



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