Tampilkan postingan dengan label HP 32Sii. Tampilkan semua postingan
Tampilkan postingan dengan label HP 32Sii. Tampilkan semua postingan

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. 


HP 32SII Applications: Moments of Inertia, Conductor Temperature Change, Slit Patterns

HP 32SII Applications: Moments of Inertia, Conductor Temperature Change, Slit Patterns


Moment of Inertia - Uniform Disk


The moment of inertia on a uniform disk of radius r is:


I = 2 * π * L * ρ * ∫(r^3 dr, 0, R) 


where ρ = M ÷ ( π * R^2 * L)


The formula of inertia for the uniform disk can be simplified to:


I = M * R^2 * 1/2

where

M = mass of the disk

R = radius of the disk

I = inertia of the center of the mass


HP 32SII Program:


I01  LBL I

I02  INPUT M

I03  INPUT R

I04  x^2

I05  ×

I06  2

I07  ÷

I08  RTN


(12.0 bytes, CK = B55F)


Example:

 

Inputs:

M = 8 kg

R = 0.2 m


Result:

I = 0.16 kg * m^2


Source:

Texas Instruments Incorporated.  Texas Instruments TI-55III Scientific Calculator Sourcebook  Second Edition.  1984



Conductor Temperature Change


The temperature change due to the change of the resistance can be calculated as:


∆t = 1 ÷ α * ( R_2 ÷ R_1 - 1)


where:

∆t = change of temperature in °C

R_2 = new resistance in Ω  (R)

R_1 = new resistance in Ω  (F)

α = temperature coefficient of resistance (A)  (see table below and source)


Selected Temperature Coefficients of Resistance at 20°C (α):


Material:  α


Nickel:  0.005866

Iron:  0.005671

Aluminum:  0.004308

Copper:  0.004041

Silver:  0.003819

Gold:  0.003715

Alloy Steel (99.% iron):  0.003


HP 32SII Program:


T01  LBL T

T02  INPUT A

T03  INPUT R

T04  INPUT F

T05  ÷

T06  1

T07  -

T08  x<>y

T09  1/x

T10  ×

T11 RTN


(16.5 bytes, CK = DDA9)


Example:


Inputs:

A = 0.004041  (α, Copper)

R = 58 Ω  (new resistance)

F = 50 Ω  (old resistance)


Result:

39.594160 °C


Sources:


"Temperature Coefficient of Resistance"  All About Circuits.  Last Retrieved May 17, 2022.  https://www.allaboutcircuits.com/textbook/direct-current/chpt-12/temperature-coefficient-resistance/#:~:text=The%20resistance%2Dchange%20factor%20per,with%20an%20increase%20in%20temperature.


National Radio Institute Alumni Association  Mathematics For Radiotricians Washington, D.C.  1942


Slit Patterns


The intensity of diffraction pattern of the single slit can be calculated by the formula:


I = Im * (sin α ÷ α)^2


where:

Im = potential maximum intensity

α = (π * s * sin θ ÷ λ) in radians

s = slit width

λ = wavelength in Hz

θ = angle of diffraction in degrees


For a double slit:


I = Im * (cos B)^2 * (sin α ÷ α)^2


where:

B is in radians and

B = (π * d * sin θ ÷ λ)

d = distance between slits

θ = angle of diffraction in degrees

α = see the single slit formula above


HP 32SII:

A:  θ

S:  slit wdith

W:  wavelength, λ

I:  maximum intensity


LBL S: single slit

LBL D: double slit, uses LBL S


HP 32SII Programs:


Single Slit:


S01  LBL S

S02  DEG

S03  INPUT A

S04  SIN

S05  INPUT S

S06  ×

S07  π

S08  ×

S09  INPUT W

S10  ÷

S11  RAD

S12  ENTER

S13  SIN

S14  x<>y

S15  ÷

S16  x^2

S17  INPUT I

S18  ×

S19  RTN


(28.5 bytes, CK = 40E0)


Double Slit:


D01  LBL D

D02  XEQ S

D03  DEG

D04  RCL A

D05  SIN

D06  INPUT D

D07  ×

D08  π

D09  ×

D10  RCL÷ W

D11  RAD

D12  COS

D13  x^2

D14  ×

D15  RTN


(22.5 bytes, CK = 8BC7)


Example:


Inputs:

A = 8°

S = 1.96E-6 m

W = 500E-9Hz

I  = 1


Single Slit Calculation:

XEQ S:  0.333496


Double Slit Calculation:

XEQ D

D = 3E-5 m

Result:  0.068409


Source:

Saul, Ken.  The Physics Collection:  Ten HP-41C Programs for First-Year Physics Class  Corvallis, OR.  1986



Coming up:  Python Week:  August 1 to August 5, 2022


Eddie


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. 

HP 32S and HP 32SII Week: Maximum, Minimum , Histogram

HP 32S and HP 32SII Week:  Maximum, Minimum , Histogram 





Introduction


The program takes data and determines:


*  maximum of the data set (X)

*  minimum of the data set (Y)

*  bin width using Scott's normal rule (h, see formula below)

*  number of bins (k, rounding is not included)


Scott's normal rule:

h = 3.49 * sx / (n^(1/3))


Number of bins:

k = (max - min) / h

In practice, take the ceiling of k.


Instructions


1.  Enter the first data point.

2.  Press XEQ D  (execute label D)

3.  Enter the next data point, press R/S.  Repeat until the last data point.

4.  Press XEQ C 


HP 32S/32SII Program:  Maximum, Minimum, Bin Width, Number of Bins

Total Size (labels D, S, C): 61.5, plus 48 bytes for statistical data

(D: 6.0, S: 18.0, C:  37.5)



D01 LBL D  // data

D02 CLΣ

D03 STO X

D04 STO Y


S01 LBL S

S02 RCL X

S03 x<>y

S04 x>y?

S05 STO X

S06 RCL Y

S07 x<>y

S08 x<y?

S09 STO Y

S10 Σ+

S11 STOP

S12 GTO S


C01 LBL C

C02 RCL X

C03 STOP

C04 RCL Y

C05 STOP

C06 -

C07 49

C08 1

C09 %   // C07 - C09: build 0.49 in 4.5 bytes instead of 9.5 bytes

C10 3

C11 +

C12 Sx

C13 ×

C14 n

C15 3

C16 1/x

C17 y^x

C18 ÷

C19 STO H

C20 STOP

C21 RCL X

C22 RCL- Y

C23 RCL÷ H

C24 STO K

C25 STOP


Example


Data Set:

4.0

5.8

5.7

5.2

4.6

4.9

6.3

7.1

6.6

6.4


4 XEQ D

5.8 R/S

5.7 R/S

...

6.4 R/S

XEQ C


X:  max:  7.1

Y:  min:  4

h:  1.58387549541

k:  1.95722454763  (2 bins)


Source:


"Histogram"  Wikipedia.  Last Updated March 28, 2022. https://en.wikipedia.org/wiki/Histogram  Last Accessed March 31, 2022.  


Up next:  a review of the HP 45 - May 9, 2022


Eddie 


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. 


HP 32S and HP 32SII Week: Jurin's Law - Capillary Rise

HP 32S and HP 32SII Week:  Jurin's Law - Capillary Rise 





Capillary Motion 


Jurin's law describes the motion of liquid in small tubes, as the height is inversely proportional to the tube's diameter (and radius).  Factors include the contact angle and the density of the liquid.


The height of the liquid is determined by:


h = (2 * σ * cos θ) / (ρ * g * r)


σ = surface tension of the liquid (N/m)  (T)

θ = the angle of liquid in degrees, from adhesive (0° to 90°) to cohesive (90° to 180°) (B)

ρ = density of liquid (kg/m^3) (D)

r = radius of the tube (m) (R)


HP 32S and HP 32SII: Jurin's Law

Size:  33.5 bytes


J01 LBL J

J02 DEG

J03 INPUT T

J04 INPUT B

J05 INPUT D

J06 INPUT R

J07 2

J08 RCL× T

J09 RCL B

J10 COS

J11 ×

J12 RCL D

J13 RCL× R

J14 9.80665

J15 ×

J16 ÷

J17 STOP


Example:

Find the capillary rise of water in a tube with radius of 0.1 m.   

Data:  σ = 0.0728 N/m, θ = 0°, and ρ = 1000 kg/m^3


Inputs:

T = 0.0728

B = 0

D = 1000

R = 0.1


Result:  1.48470681E-4 m  (height)


Source:


"Jurin's law" Wikipedia.  Last updated February 11, 2022.  https://en.wikipedia.org/wiki/Jurin%27s_law  Last Accessed April 1, 2022.  


Lindeburg, Michael R. PE   Civil Engineering Reference Manual for the PE Exam 14th Edition  Professional Publications, Inc:  Belmont, CA.  pp. 14-11 to 14-13


Eddie


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. 


HP 32S and HP 32SII Week: Total Drag

HP 32S and HP 32SII Week:  Total Drag





Introduction


The following equation calculates the total drag force applied to parallel to an area in the opposite direction of the object's motion.  


Fd = 1/2 * ρ * v^2 * Cd * A,   ρ = P / (R * T)


ρ = air pressure 

P = absolute pressure (101,325 Pa, 14.696 psi, 2116.224 lb/ft^2)

R = specific gas constant (287.03 J/(kg k), 53.3533 (ft lbf/lb °R))

T = temperature (K = °C + 273.15, °R = °F + 459.67)


A = cross area that the drag force is applied (m^2, ft^2)

V = velocity of the object (m/s, ft/s)

Cd = drag coefficient (unitless)


The program gives outputs:


ρ = air pressure (kg/m^3, lb/ft^3)

Fd = total drag (kg*m/s^2, lb*ft/s^2)


HP 32S/32SII Program:  Total Drag, SI Units

Size: 55.5 bytes


F01 LBL F

F02 INPUT C

F03 INPUT A

F04 INPUT V

F05 INPUT T

F06 273.15

F07 +

F08 287.03

F09 ×

F10 1/x

F11 101,325

F12 ×

F13 STOP

F14 RCL× C

F15 RCL× A

F16 RCL V

F17 x^2

F18 ×

F19 2

F20 ÷

F21 STOP


Example:

C = drag coefficient = 0.31

A = area =7.0686 m^2

T = temperature = 18.8 °C

V = velocity = 3 m/s


Results:

ρ = 1.20915184207 kg/m^3

Fd = 11.9230799416 kg*m/s^2


HP 32S/32SII Program:  Total Drag, US Units

Size: 55.5 bytes


F01 LBL F

F02 INPUT C

F03 INPUT A

F04 INPUT V

F05 INPUT T

F06 459.67

F07 +

F08 53.3533

F09 ×

F10 1/x

F11 2116.224

F12 ×

F13 STOP

F14 RCL× C

F15 RCL× A

F16 RCL V

F17 x^2

F18 ×

F19 2

F20 ÷

F21 STOP


Example:

C = drag coefficient = 0.31

A = area =76.0868 ft^2

T = temperature = 65.84 °F

V = velocity = 9.84252 ft/s


Results:

ρ = 7.54778228E-2 lb/ft^3

Fd = 86.232900381 lb*ft/s^2



Source:


Lindeburg, Michael R. PE   Civil Engineering Reference Manual for the PE Exam 14th Edition  Professional Publications, Inc:  Belmont, CA.  pp. 17-41 and 17-42


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. 


HP 32S and HP 32SII Week: Hypergeometric Distribution

 HP 32S and HP 32SII Week:  Hypergeometric Distribution





What are the Odds?


The hypergeometric probably function deals with taking samples without replacement.  The trials are not independent.  The probability formula is:


G(S; N, T, M) =

1 ÷ nCr(N, M) * nCr(T, S) * nCr(N-T, M-S)


S = number of successes

N = main population size

T = target's population size

M = sample size


nCr(x, y) = x! ÷ ( y! * (x - y)!)


HP 32S/32SII Program:  Hypergeometric Distribution Probability

Size: 30 bytes


H01 LBL H

H02 INPUT S

H03 INPUT N

H04 INPUT T

H05 INPUT M

H06 RCL N

H07 RCL M

H08 Cn,r

H09 1/x

H10 RCL T

H11 RCL S

H12 Cn,r

H13 ×

H14 RCL N

H15 RCL- T

H16 RCL M

H17 RCL-S

H18 Cn,r

H19 ×

H20 STOP


Examples:


What are the odds that four hearts are dealt out of a five card hand?  Assume a standard, 52 card deck.


S = 4 (4 hearts)

N = 52 (52 cards)

T = 13 (13 hearts)

M = 5 (5 card hand)


Result:  1.07292917E-2 (≈1.07%)


What are the odds that a pair of Kings are dealt out of a five card hand?  Assume a standard, 52 card deck.


S = 2 (2 Kings)

N = 52 (52 cards)

T = 13 (13 hearts)

M = 5 (5 card hand)


Result:  3.99298181E-2 (≈3.99%)


Source:


"Hypergeometric Distribution"  Texas Instruments Programmable Slide-Rule SR-56 Applications Library  pp. 58-59 Texas Instruments, 1976


Download the document here, with gratitude to Datamath:

http://www.datamath.net/Manuals/SR-56_AL_US.pdf


Eddie



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. 


HP 32S and HP 32SII Week: Richter Scale

HP 32S and HP 32SII Week:  Richter Scale





Richter Scale


The equation calculates the massive energy given by a earthquake given the earthquake's magnitude by the Richter scale:


E = 10^(11.3 + 1.8 * M), where E is in ergs

 

with conversions:


Ergs to Joules:  multiply by 1 * 10^-7


Ergs to ft-lbs:  multiply by 7.3756 * 10^-8




Equation Modifications



Energy of an earthquake, given by Richter scale, in Joules (SI units):


E = 10^(4.3 + 1.8 * M)




Energy of an earthquake, given by Richter scale, in Foot-Pounds (US units):


E ≈ 10^(4.1678 + 1.8 * M)




HP 32S/32SII Program:  Earthquake Energy - SI Units

Size: 13.5 bytes


R01 LBL R

R02 18

R03 ×

R04 43

R05 +

R06 10

R07 ÷

R08 10^x

R09 STOP


Example:  3.4 Magnitude


Result:  26,302,679,919 J


Notes:


*  In general, each step takes 1.5 bytes.  


*  Integers 0 to 99 (HP 32S) and 0 to 254 (HP 32SII) takes 1.5 bytes while all other real numbers takes 9.5 bytes.  It could be advantageous to build numbers out of small integers than enter real number constants.  Using a real constant uses 6 steps.  


* It's supposed to be advantageous to end programs with STOP (R/S) than RTN. 



HP 32S/32SII Program:  Earthquake Energy - US Units

Size: 21.5 bytes


R01 LBL R

R02 18

R03 ×

R04 10

R05 ÷

R06 4.1678

R07 +

R08 10^x

R09 STOP


Example:  3.4 Magnitude


Result:  19,399,922,723.9 ft-lbs



Source:


Young, G.B.  "Earthquake Magnitude - Energy Conversation"  Hewlett-Packard HP-674/HP-97 User's Library Solutions:  Earth Sciences  Hewlett Packard:  Corvallis, OR.  pp. 1-4 February 1978


Download the document here, with gratitude to hpcalc.org:

https://literature.hpcalc.org/items/1015


Eddie


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. 

 

Backlink 9999 Traffic Super

Order Now...!!!!