Sunday, August 24, 2025

HP 20S: Acoustics Programs

HP 20S: Acoustics Programs


Program A: Speed of Sound in Dry Air


cs = 20.05 × √(273.15 + T°C)


Code:

01: 61, 41, A: LBL A

02: 75: +

03: 2: 2

04: 7: 7

05: 3: 3

06: 73: .

07: 1: 1

08: 5: 5

09: 74: =

10: 11: √

11: 55: ×

12: 2: 2

13: 0: 0

14: 73: .

15: 0: 0

16: 5: 5

17: 74: =

18: 61, 25: RTN



Program B: Mersenne's Law: Fundamental Frequency



f0 = √(F ÷ µ) ÷ (2 × L)

F: force (N)

µ: mass per unit length (kg/m)

L: string length (m)

f0: fundamental frequency (Hz)

(Marshall, pg. 19)



Store before running:

R1: force

R2: µ

R3: L



Code (continuing from the previous section):

19: 61, 41, b: LBL B

20: 33: (

21: 22, 1: RCL 1

22: 45: ÷

23: 22, 2: RCL 2

24: 34: )

25: 11: √

26: 45: ÷

27: 33: (

28: 2: 2

29: 55: ×

30: 22, 3: RCL 3

31: 34: )

32: 74: =

33: 61, 26: RTN



Program C: Standing Wavelength in an Open Pipe for the 1st through 5th Harmonic



λ = 2 × L ÷ n

L: length of the pipe

n: nth harmonic (positive integer)

(Marshall, pg. 21)



Code (continuing from the previous section):

34: 61, 41, C: LBL C

35: 21, 1: STO 1

36: 1: 1

37: 21, 2: STO 2

38: 61, 41, 3: LBL 3

39: 2: 2

40: 55: ×

41: 22, 1: RCL 1

42: 45: ÷

43: 22, 2: RCL 2

44: 74: =

45: 26: R/S

46: 1: 1

47: 21, 75, 2: STO+ 2

48: 22, 2: RCL 2

49: 31: INPUT

50: 5: 5

51: 61, 42: x≤y?

52: 51, 41, 3: GTO 3

53: 61, 26: RTN



Program D: Finding the perfect length and height for recording studios given the width.



Length = W × φ (stored in R1)

Width = W (stored in R2)

Height = W ÷ φ (stored in R3)

φ = (1 + √5) ÷ 2

(Marshall, pg. 34)



Code (continuing from the previous section):

54: 61, 41, d: LBL D

55: 21, 1: STO 1

56: 22, 2: STO 2

57: STO 3: STO 3

58: 33: (

59: 1: 1

60: 75: +

61: 5: 5

62: 11: √

63: 34: )

64: 45: ÷

65: 2: 2

66: 74: =

67: 21, 55, 1: STO× 1

68: 21, 45, 3: STO÷ 3

69: 22, 1: RCL 1

70: 26: R/S

71: 22, 2: RCL 2

72: 26: R/S

73: 22, 3: RCL 3

74: 61, 26: RTN


HP 20S - The Complete Code:

01: 61, 41, A: LBL A

02: 75: +

03: 2: 2

04: 7: 7

05: 3: 3

06: 73: .

07: 1: 1

08: 5: 5

09: 74: =

10: 11: √

11: 55: ×

12: 2: 2

13: 0: 0

14: 73: .

15: 0: 0

16: 5: 5

17: 74: =

18: 61, 25: RTN

19: 61, 41, b: LBL B

20: 33: (

21: 22, 1: RCL 1

22: 45: ÷

23: 22, 2: RCL 2

24: 34: )

25: 11: √

26: 45: ÷

27: 33: (

28: 2: 2

29: 55: ×

30: 22, 3: RCL 3

31: 34: )

32: 74: =

33: 61, 26: RTN

34: 61, 41, C: LBL C

35: 21, 1: STO 1

36: 1: 1

37: 21, 2: STO 2

38: 61, 41, 3: LBL 3

39: 2: 2

40: 55: ×

41: 22, 1: RCL 1

42: 45: ÷

43: 22, 2: RCL 2

44: 74: =

45: 26: R/S

46: 1: 1

47: 21, 75, 2: STO+ 2

48: 22, 2: RCL 2

49: 31: INPUT

50: 5: 5

51: 61, 42: x≤y?

52: 51, 41, 3: GTO 3

53: 61, 26: RTN

54: 61, 41, d: LBL D

55: 21, 1: STO 1

56: 22, 2: STO 2

57: STO 3: STO 3

58: 33: (

59: 1: 1

60: 75: +

61: 5: 5

62: 11: √

63: 34: )

64: 45: ÷

65: 2: 2

66: 74: =

67: 21, 55, 1: STO× 1

68: 21, 45, 3: STO÷ 3

69: 22, 1: RCL 1

70: 26: R/S

71: 22, 2: RCL 2

72: 26: R/S

73: 22, 3: RCL 3

74: 61, 26: RTN


Examples


LBL A:

Input: T = 0°C: Speed of sound: 331.371367011 m/s

Input: T = 10°C (50°F): Speed of sound: 337.82583835 m/s

Input: T = 26.66666667 (80°F) C: Speed of sound: 347.170058532 m/s



LBL B:

R1: 45 N, R2: 0.008 kg, R3: 0.06 m; f: 625 Hz

R1: 3 N, R2: 0.006 kg, R3: 0.058 m; f: 192.764480819 Hz



LBL C:

Open ended pipe length: 1.2 m

The wavelengths for the 1st, 2nd, 3rd, 4th, and 5th harmonics respectively:

2.4, 1.2, 0.8, 0.6, 0.48

Open ended pipe length: 0.059 m

The wavelengths for the 1st, 2nd, 3rd, 4th, and 5th harmonics respectively:

0.118, 0.059, 3.933333333E-2, 0.0295, 0.0236



LBL D:

Width: 12 ft; Length: 19.416407865 ft, Height: 7.416407865 ft

Width: 18 ft 6 in = 18.5 ft; Length: 29.9336287919 ft, 11.4336287919 ft



Source

Marshall, Steve. Acoustics: The Art of Sound. Wooden Books, LLC. San Rafael, California. 2023. ISBN 978-1-952178-33-7


Eddie


All original content copyright, © 2011-2025. 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.


The author does not use AI engines and never will.

Saturday, August 23, 2025

Casio fx-92 Collège: Plotting Lines, Regular Polygons, and Functions

Casio fx-92 Collège: Plotting Lines, Regular Polygons, and Functions


Introduction


The Casio fx-92 Collège has an algorithm application which is similar to Scratch. For more details, please refer to the Alogirthmique Mode section of my spotlight review:


https://edspi31415.blogspot.com/2025/02/spotlight-casio-fx-92-college.html


A limitation of the fx-92 Collège is that programs are not retained once we leave the Algorithmique Mode or turn the calculator off.


Remember that the commands, the mathematical functions, and keys on the calculator fx-92 Collège are in French. The left column is what will see on the calculator screen** (in French) and the right column is a “rough” translation to English. Please note that I am currently not fluent in French.


** Demander valuer is just shown as ? → var. (Prompt for a value)

** Metire var á is shown as expression → var. (Store an expression to a variable)


Draw a line y = Ax + B.


French: fx-92 Collegè

English Translation

(Demander valeur) ? → A

? → A

(Demander valeur) ? → B

? → B

(Metire var á) (-24 – B) ÷ A →C

(-24 – B) ÷ A →C

(Metire var á) (24 – B) ÷ A →D

(24 – B) ÷ A →D

Si C ≥ D Alors

If C ≥ D Then

(Metire var á) C →E

C →E

(Metire var á) D →C

D →C

(Metire var á) E →D

E →D

Fin

End

Stylo relevè

Pen is raised

Aller à x = C ; y = A×C + B

Go to C, A × C + B

S’ orienter à tan^-1(A) degrès

Set orientation to arctan(A) degrees

Stylo écrit

Pen is down

Avancer de √((D-C)^2 + 48^2) pixels

Move forward √((D-C)^2 + 48^2) pixels

The algorithm draws a line when -24 ≤ y ≤ 24. If x is in the range -96 ≤ x ≤ 95, the line will be plotted on the screen.


The algorithm solves the following equations:


A x + B = -24

A x + B = 24


where the minimum of the two results are stored in C and the maximum of the two results are stored in D.


The equation is given in standard form where A is the slope and B is the y-intercept. If we go to the left side of the line (Xmin) and head to the right, we can draw the line in the direction of the slope, which is calculated by arctan(A). The arc-tangent function typical has a range between -180° to 180° (-π radians to π radians).



Draw a Regular Polygon


Draw a regular polygon of B sides. The radius is fixed at 20 pixels. The polygon is drawn in the middle of the screen.


French: fx-92 Collegè

English Translation

(Demander valeur) ? → B

? → B

(Metire var á) 40 × sin(180° ÷ B) → C

40 × sin(180° ÷ B) → C

Stylo relevè

Pen raised

Aller à x = -C ÷ 2; y = -20

Go to -C ÷ 2, -20

(Metire var á) 1 → A

1 → A

Stylo écrit

Pen is down

Répéter jusqú a A>B

Repeat until A > B

Avancer de C pixels

Move forward C pixels

Tourner de ⟲ 360° ÷ B degrès

Turn (360° ÷ B) degrees

(Metire var á) 1 + A → A

1 + A → A

End repeat loop



The program begins by determining the required side length and positioning the cursor to the point (-C/2, -20). This allows the polygon to drawn in the middle of the screen.



The relationship between the radius of regular polygon (r) and the side length (s) is:


s = 2 * r * sin(180° / n) = 2 * r * sin(π radians/n)


With r = 20, s = 40 * sin(180° / n)


The degree symbol is found in the Catalog → Angl/Coord/Sexag → Degrés.


The variable B is used for the number of sides.




Draw the Function C = f(z).


A = z minimum (Xmin), B = z maximum (Xmax)


Be aware that the plotting screen is limited and there is no ability to zoom. (-96 ≤ z ≤ 95)


The fx-92 errors if C < -999 or C > 999.


French: fx-92 Collegè

English Translation

(Demander valeur) ? → A

? → A

(Demander valeur) ? → B

? → B

(Metire var á) A→ z

A → z

Répéter jusqú a z >B

Repeat until z > B

(Metire var á) f(z)→ C (**)

f(z)→ C (**)

Si z = A Alors

If z = A Then (we are at the xmin at the graph)

Stylo relevè

Pen Raised

Sinon

Then

Stylo écrit

Pen is Down

Fin

End (If)

Aller à x = z ; y = C

Go to z ; C

(Metire var á) z + 0,5→ z

z + 0.5→ z

End repeat loop


Here is where you enter you function. Examples may include:


15 × cos((z ÷ 10)^r ) (^r: Catalog → Angl/Coord/Sexag → Radians)


√z


Abs(z – 3) (Catalog → Cacul Numèrique → Value Absolue)


-2 × z + 1.1


e^(-z) (Catalog → Autre → select e)



Eddie


All original content copyright, © 2011-2025. 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.

The author does not use AI engines and never will.


Saturday, August 16, 2025

RPN: HP 32S & DM42: Converting Real Numbers to Hexadecimal Approximations

RPN: HP 32S & DM42: Converting Real Numbers to Hexadecimal Approximations



Introduction


We know calculators that have base conversions easily convert integers to different bases. But what about all real numbers? Not so much. Today’s blog will tackle it.


The procedure given today should work for converting from decimal to octal, binary, and hexadecimal. I chose hexadecimal:


0.A B C D… _16

The digit A is in units of 1/16.

The digit B is in units of 1/16^2 or 1/256.

The digit C is in units of 1/16^3 or 1/4096.

The digit D is in units of 1/16^2 or 1/65536.

and so on.


Note: The procedure considers positive real numbers only.


Example: Convert 7.86 to hexadecimal using 4 places


In hexadecimal, 4 places translates to terms of 1/65536.


Separate 7.86 into its integer and fractional parts.

Integer Part: 7

Fractional Part: 0.86

Convert the fractional part to n parts of 65536. (16^4)*

0.86 * 65536 = 56360.96

Round n to the nearest integer. Use the formula: int(n + 0.5) = int(n + 1/2)

Int(56360.96 + 0.5) = 53361

(round(56360.96, 0) = 53361)

Convert both original integer part and the last result to hexadecimal.

Integer Part: 7_10 → 7_16

Frac in terms of 65536: 53361_10 → DC29_16

**If the fractional part has less than four* digits showing in the calculator, pad the converted part with zeros on the left.


The approximate answer reads as:

7.86_10 → 7.DC29_16

Recall in Hexadecimal:

A=10, B=11, C=12, D=13, E=14, F=15.


* precision: number of places.


HP 32S/HP 32SII/DM32 Code


H01 LBL H

H02 ENTER

H03 IP

H04 x<>y

H05 FP

H06 16

H07 4 (** - accuracy level, number of places)

H08 y^x

H09 ×

H10 2

H11 1/x

H12 +

H13 IP

H14 HEX

H15 STOP

H16 DEC

H17 RTN



HP 42S/DM42 Code


01 LBL “→HEX”

02 ENTER

03 IP

04 x<>y

05 FP

06 16

07 4 (** - accuracy level, number of places)

08 Y↑X

09 ×

10 0.5

11 +

12 IP

13 HEXM

14 STOP

15 EXITALL

16 RTN



When the program stops initially, the results are shown as follows:

Y: integer part

X: fractional part – right justified


Remember the number of places (precision) because if the fractional part has less digits, pad zeroes to the left.


Examples


n = precision = 4

Decimal

Y: Hex Integer

X: Hex Fractional (displayed)

Result (base 16)

3.5

3

8000

3.8000

π

3

243F

3.243F

√2

1

6A0A

1.6A0A

0.6732

0

AC57

0.AC57

0.0002

0

D

0.000D

e^4.1

3C

571D

3C.571D

8.2^1.7

23

C460

23.C460



Eddie


All original content copyright, © 2011-2025. 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.


All posts are 100% generated by human effort.  The author does not use AI engines and never will.


HP 20S: Acoustics Programs

HP 20S: Acoustics Programs Program A: Speed of Sound in Dry Air cs = 20.05 × √(273.15 + T°C) Code: 01: 61, 41, A: LBL A 02: ...