Showing posts with label dew point. Show all posts
Showing posts with label dew point. Show all posts

Sunday, November 20, 2022

HP 32SII: Some Algorithms For RPN Calculators

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. 


Saturday, July 9, 2016

HP 42S Programming Part II: Dew Point, Ellipse Area and Eccentricity, Easy Transverse

HP 42S Programming Part II:  Dew Point, Ellipse Area and Eccentricity, Easy Transverse

Click here for Part I:  Matrix Column Sum, GCD, Error Function

(I plan to post Part III next week.)

As mentioned in Part I, you can download an emulator for the HP 42S, Free42 here: http://thomasokken.com/free42/ .  The emulator is for many operating systems including Windows, Mac, iOS, and Android.  



HP 42S:  Dew Point (°C)


00 {99-Byte Prgm}
01 LBL “DEW”
02 “TEMP °C:”
03 PROMPT
04 STO “T”
05 “HUMIDITY %”
06 PROMPT
07 STO “H”
08 LN
09 17.27
10 RCL* “T”
11 237.3
12 RCL+ “T”
13 ÷
14 +
15 17.27
16 ÷
17 STO “V”
18 237.3
19 RCL* “V”
20 1
21 RCL- “V”
22 ÷
23 “DEW POINT °C”
24 ARCL ST X
25 AVIEW
26 STOP
27 END

Instructions:  Execute GTO DEW from Home.  Press [R/S].

Test:  Input:  T:  20°C, H = 0.50
Result:  9.2696°C

 HP 42S:  Area and Eccentricity of an Ellipse

The program ELLIPSE calculates the area and eccentricity of an ellipse. 

Formulas:
Assume a>b, where a and b represent the lengths of semi-diameters, respectively
Area:  A = π*a*b
Eccentricity:  ϵ = √(1 – (b/a)^2)

00 {76-Byte Prgm}
01 LBL “ELLIPSE”
02 “LARGE S-D:”  \\ S-D:  semi-diameter
03 PROMPT
04 STO “A”
05 “SMALL S-D:” 
06 PROMPT
07 STO “B”
08 RCL “A”
09 RCL* “B”
10 PI  \\ π
11 *
12 “AREA:”
13 AVIEW
14 PSE
15 STOP \\ R/S
16 1
17 RCL “B”
18 RCL÷ “A”
19 X^2
20 –
21 SQRT
22 “ECC:”
23 AVIEW
24 PSE
25 END

HP 42S Easy Transverse

Calculates the new point knowing the original coordinates, direction, and angle of travel.  The angle 0° comes from due east and rotates counterclockwise.  The program sets the HP 42S to degrees mode.  We make use of the Programmable Menu. 

00 {183-Byte Prgm}
01 LBL “EASYTRV”
02 DEG
03 0
04 STO “T”   \\ initialize total distance counter
05 “INITIAL EASTING”
06 PROMPT
07 STO “E”
08 “INIT. NORTHING”
09 PROMPT
10 STO “N”
11 LBL 00 \\ main label
12 XEQ 01 \\ go to calculation sub loop
13 LBL 03 \\ start menu label
14 CLMENU
15 “NEXT”
16 KEY 1 XEQ 01 \\ KEYX command
17 “QUIT”
18 KEY 2 GTO 02 \\ KEYG command
19 MENU
20 STOP
21 GTO 03 \\ end menu loop
22 LBL 01 \\ main calculation loop
23 CLRMENU \\ make both lines available for viewing
24 “ANGLE (0°-360°)”
25 PROMPT
26 STO “A”
27 “DISTANCE”
28 PROMPT
29 STO “D”
30 STO+ “T”
31 →REC
32 STO+ “E”
33 X<>Y
34 STO+ “N”
35 RCL “E”
36 “EAST:”
37 ARCL ST X
38 AVIEW
39 STOP
40 RCL “N”
41 “NORTH:”
42 ARCL ST X
43 AVIEW
44 RTN
45 LBL 2  \\ finalization sub routine
46 CLMENU
47 RCL “T”
48 “ΣDIST:”   \\  Σ is from the ALPHA-MATH menu
49 ARCL ST X
50 AVIEW
51 STOP
52 RCL “N”
53 RCL “E”
54 END

Test:
Initial Data Coordinates:  N = 1,000,  E = 1,000
Travel #1:  170 units at 118°  (28° NW)
Travel #2:  162 units at 45°  (45° NE)

Input:
[XEQ] {EASYT}
1000 [R/S] [R/S]
118 [R/S] 170 [R/S]

Result:
EAST: 920.1898 [R/S],  NORTH: 1,150.1011

{NEXT} 45 [R/S] 162 [R/S]

EAST:  935.5061 [R/S], NORTH:  1,192.4143

{QUIT} ΣDIST:  215 [R/S], N on Y stack, E on X stack. 


 This blog is property of Edward Shore, 2016.


Monday, July 4, 2016

TI-65 Programs Part I: Digital Root, Complex Number Multiplication, Dew Point

TI-65 Programs Part I:  Digital Root, Complex Number Multiplication, Dew Point

Recently working with the HP-71B and Radio Shack EC-4004, I am feeling the 1980s vibes and staying in the decade for the 1987 classic calculator Texas Instruments TI-65.   

Some background information of the TI-65 (provided by Datamath):  http://www.datamath.org/Sci/Galaxy/TI-65.htm

Did you know the TI-65 has a timer?  Click here to see a video demonstration!



This is the first part of programs for the TI-65 for this Fourth of July.    

Click here for Part II:  Reynold’s Number/Hydraulic Diameter, Escape Velocity, Speed of Sound/Resonant Frequencies in an Open Pipe


TI-65 Digital Root

Takes the digital root of an integer.  To find the digital root:

1.  Add up the number’s digits.
2.  The sum is over 10, add the digits again.
3.  Repeat step 2 until you get a single digit.

Or alternatively, use the formula dr(n) = 1 + ((n-1) mod 9) = n – 9 * intger((n-1)/9)

Program:
CODE
STEP
KEY
12.0
00
STO 0
49
01
-
9
02
9
38
03
*
16
04
(
16
05
(
13.0
06
RCL 0
49
07
-
1
08
1
17
09
)
28
10
÷
9
11
9
17
12
)
2nd 27
13
ITNG
14
14
=
51
15
R/S

Input:  Enter integer, press [RST] [R/S]

Test 1:  dr(1555) = 7
Test 2:  dr(38267) = 8

TI-65 Complex Multiplication

(a + bi)*(c + di) = (r1*r2) * e^(i*(θ1 + θ2))

Where r1 ∠ θ1 is the polar form of a + bi and r2 ∠ θ2 is the polar form of c + di.

Program:
CODE
STEP
KEY
COMMENT
44
00
X<>Y
Start with a
51
01
R/S
Prompt for b
-2nd 22
02
INV 2nd P-R
Convert to Polar
12.1
03
STO 1

44
04
X<>Y

12.0
05
STO 0

51
06
R/S
Prompt for c
44
07
X<>Y

51
08
R/S
Prompt for d
-2nd 22
09
INV 2nd P-R
Convert to Polar
12.59
10
STO+

1
11
1
STO+ 1
44
12
X<>Y

12.38
13
STO*

0
14
0
STO* 0
13.0
15
RCL 0

44
16
X<>Y

13.1
17
RCL 1

2nd 22
18
2nd P-R
Convert to Rectangular
51
19
R/S
Display imaginary part of product
44
20
X<>Y

51
21
R/S
Display real part of product

(a + bi)*(c + di) = x + yi
Input:  a [RST] [R/S], b [R/S], c [R/S], d [R/S]
Output:  y [R/S], x

Test 1:  (5-3i)*(4+i):
5 [RST] [R/S]. -3 [R/S], 4 [R/S], 1 [R/S]
Result:  -7 [R/S] 23,   23-7i

Test 2:  (-6+3i)*(2 + 2i)
Result:  -18 – 6i

TI-65  Dew Point Calculation

This program accepts input and displays dew point in degrees Fahrenheit (°F).


CODE
STEP
KEY
COMMENT
3rd 28
00
3rd °F-°C
Convert to °C
12.0
01
STO 0

38
02
*

1
03
1

7
04
7

57
05
.
Decimal Point
2
06
2

7
07
7

12.1
08
STO 1

28
09
÷

16
10
(

2
11
2

3
12
3

7
13
7

57
14
.
Decimal Point
3
15
3

12.2
16
STO 2

59
17
+

13.0
18
RCL 0

17
19
)

59
20
+

51
21
R/S
Prompt for h
32
22
LN

39
23
=

28
24
÷

13.1
25
RCL 1

39
26
=

12.1
27
STO 1

38
28
*

13.2
29
RCL 2

28
30
÷

16
31
(

1
32
1

49
33
-

13.1
34
RCL 1

17
35
)

39
36
=

-3rd 28
37
INV 3rd °F-°C
Convert to °F
51
38
R/S


 Input:  Enter temperature in °F [RST] [R/S], enter humidity (as a decimal) [R/S]
Output:  Dew Point in °F

Test 1:  temperature = 68°F,  humidity = 0.5  (50%)
68 [RST] [R/S], 0.5 [R/S]
Result:  dew point ≈ 48.68533155°F

Temp 2:  temperature = 93°F, humidity = 0.35
Result:  dew point ≈ 61.29167421°F

Happy Birthday United States!




This blog is property of Edward Shore, 2016.

Numworks (Python): Parallelograms Described by Vectors

Numworks (Python): Parallelograms Described by Vectors Introduction The script drawpgram.py draws a parallelogram constructed by ...