HP 32SII: Some Algorithms For RPN Calculators
Four programs ported to the HP 32SII calculator from algorithms designated for the 1973 HP 45 calculator.
HP 32SII: Euclid Algorithm - Greatest Common Divisor (GCD)
The HP 45 algorithm is found on page 228 in the Algorithms For RPN Calculators book. (see source below)
This algorithm takes up three labels.
E01 LBL E
E02 INPUT M
E03 ENTER
E04 ENTER
E05 ENTER
E06 INPUT N
E07 x<>y
K01 LBL 1
K02 ÷
K03 FP
K04 ×
K05 1
K06 x>y?
K07 GTO L
K08 R↓
K09 ENTER
K10 ENTER
K11 R↓
K12 R↓
K13 GTO K
L01 LBL L
L02 R↓
L03 R↓
L04 RTN
Sizes and Checksums:
E: 10.5 bytes, 9D4D
K: 19.5 bytes, F8AD
L: 6.0 bytes, C304
Total: 36.0 bytes
Instructions:
Press [ XEQ ] E, enter M and N.
Examples:
Input: M = 36, N = 28. Result: 4
Input: M = 48, N = 126. Result: 6
Input: M = 115, N = 300. Result: 5
HP 32SII: GCD Using One Label - John Kenney
The program was provided by Ross Barnes, and the algorithm is from the book ENTER by J. Daniel Dodlin and Keith Jarrett (ISBN 0-9615174-2-1, pg. 84). This is smart, one label program.
Enter both numbers in the stack before running the program.
G01 LBL G
G02 ENTER
G03 ENTER
G04 -
G05 R↓
G06 x<>y
G07 LASTx
G08 /
G09 LASTx
G10 RDN
G11 IP
G12 x
G13 -
G14 x≠0?
G15 GTO G
G16 +
G17 RTN
Size and Checksum: 25.5 bytes, 4E39
Posted with permission.
HP 32SII: Tetens Equation
The HP 45 algorithm is found on page 290 in the Algorithms For RPN Calculators book. The original algorithm took the temperature in Celsius.
Find the saturation of water vapor (e_m) in mmHg (millimeters of Mercury) given the temperature in °F.
Determined Formulas:
T (in °C) = (T°F - 32) * 5/9
α = T/(236.87 + T)
e_m = 4.579 * 10^(7.49 * α)
T01 LBL T
T02 INPUT T
T03 →°C
T04 ENTER
T05 ENTER
T06 236.87
T07 +
T08 ÷
T09 7.49
T10 ×
T11 10^x
T12 4.579
T13 ×
T14 RTN
Size and Checksum:
45.0 bytes, 404A
Examples:
T = 68 °F, Result: 17.53658 mmHg
T = 99 °F, Result: 47.63501 mmHg
HP 32SII: Dew Point Given Relative Humidity and Air Temperature
The HP 45 algorithm is found on page 290 in the Algorithms For RPN Calculators book. The original algorithm took the temperature in Celsius.
Relativity humidity (F) is to be entered as a decimal. For instance, instead of 20%, enter 0.20.
Determined Formulas:
T (in °C) = (T°F - 32) * 5/9
A = T/(T + 236.87)
B = 1/(log F/7.49 + A)
TD = 236.87/(B - 1)
TD = TD * 9/5 + 32
D01 LBL D
D02 INPUT T
D03 →°C
D04 ENTER
D05 ENTER
D06 236.87
D07 STO A
D08 +
D09 ÷
D10 INPUT F
D11 LOG
D12 7.49
D13 ÷
D14 +
D15 1/x
D16 1
D17 -
D18 RCL÷ A
D19 1/x
D20 →°F
D21 RTN
Size and Checksum:
47.5 bytes, 8677
Examples:
T = 80, F = 0.64, Result: 66.725
T = 95, F = 0.32, Result: 60.50684
HP 32SII: Effective Temperature Due to Wind Velocity
The HP 45 algorithm is found on page 291 in the Algorithms For RPN Calculators book. The original algorithm took the temperature in Fahrenheit.
Wind velocity is in miles per hour (mph).
Determined Formulas:
A = 0.634*(0.634 - log V)
ΔT = A*(T - 90)
Effective T = T - ΔT
E01 LBL E
E02 0.634
E03 ENTER
E04 ENTER
E05 INPUT V
E06 LOG
E07 -
E08 ×
E09 INPUT T
E10 ENTER
E11 90
E12 -
E13 ×
E14 RCL T
E15 x<>y
E16 -
E17 RTN
Size and Checksum:
33.5 bytes, 54F7
Examples:
V = 20 mph, T = 15 °F, Result: -16.71728
V = 15 mph, T = 86 °F, Result: 84.62526
Source:
Ball, John A. Algorithms For RPN Calculators John Wiley & Sons: New York, NY. 1978. ISBN 0-471-03070-8
For the second GCD program:
Dodin, J. Daniel and Keith Jarrett. ENTER: Reverse Polish Notation Made Easy Synthetix: Berkeley, CA ISBN 0-9612174-2-1 1984.
Special thanks and gratitude to Ross Barnes.
All original content copyright, © 2011-2022. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.
Tidak ada komentar:
Posting Komentar