Showing posts with label Swiss Micros DM42. Show all posts
Showing posts with label Swiss Micros DM42. Show all posts

Saturday, March 9, 2024

Casio FX-702P, Swiss Micros DM42, HP 27S: Design of Coil Spring

Casio FX-702P, Swiss Micros DM42, HP 27S: Design of Coil Spring


Today’s blog calculates the load of a coil spring.


Variables Used


P

LOAD

Load (kg)

G

SHEAR

Shear Modulus (kg/mm^2)

A

WDIA, W.DIA

Diameter of the wire (mm)

Y

DEFL

Deflection (mm)

N, NA

#COIL

Number of Coils

D

CDIA, C.DIA

Diameter of the coil (mm)

K = (G×A^4)÷(8×N×D)


Spring Constant (kg/mm)
(FX-702P only)



Casio FX-702P Code


The original BASIC programs are listed here (Casio, pg. 72, Program Library FX-702P, see sources):

5 FOR L=1 TO 5

10 INP “K,P:1,A:2,D:3,NA:4”,I

20 FOR J=1 TO 4

30 IF I=J THEN 100

40 NEXT J

50 GOTO 10


100 INP “G=”,G

110 G=G/8

120 IF I=2 THEN 150

130 INP “A=”,A:A=A↑4

140 IF I=3 THEN 170

150 INP “D=”,D:D=D↑3

160 IF I=4 THEN 180

170 INP “NA”=,N

180 INP “Y=”,Y

190 IF I=1;K=G*A/N/D:P=K*Y:PRT “K=”;K,”P=”;P:GOTO 240

200 INP “P=”,P

210 IF I=2;A=(P*D*N/G/Y)↑(1/4):PRT “A=”;A:GOTO 240

220 IF I=3;D=(A*G*Y/N/P)↑(1/3):PRT “D=”;D:GOTO 240

230 N=G*A*Y/D/R:PRT “NA=”;N

240 NEXT L

250 END


INP: input

PRT: print


Swiss Micros DM42 Solver Code: SPRING


Also for HP 42S, Free42, Plus42.


00 { 103-Byte Prgm }
01▸LBL "SPRING"
02 MVAR "LOAD"
03 MVAR "SHEAR"
04 MVAR "W.DIA"
05 MVAR "C.DIA"
06 MVAR "#COIL"
07 MVAR "DEFL"
08 RCL "SHEAR"
09 RCL "W.DIA"
10 4
11 Y↑X
12 ×
13 RCL× "DEFL"
14 8
15 RCL× "#COIL"
16 RCL "C.DIA"
17 3
18 Y↑X
19 ×
20 ÷
21 +/-
22 RCL+ "LOAD"
23 RTN
24 .END.


Run SPRING through the SOLVER.



HP 27S Equation: SPRING


Spaces added for readability.


SPRING: SHEAR × WDIA^4 × DEFL ÷ (8 ×#COIL × CDIA^3)



Example: Copper Spring Coil


Shear: G = 4558.131472 kg/mm^2

Coil Diameter: D = 10 mm

Wire Diameter: A = 0.7 mm

Deflection: Y = 5 mm

Number of Coils: N = 4


Result: Load: P: 0.17100 kg



Calculate the wire diameter if the load is 0.25 kg.


Result: Wire Diameter: A: 0.79672 mm



What if instead we have 8 coils? Wire diameter resets to 0.7 mm.


Result: Load: P: 0.08550 kg




Table of Shear Modulus Values


These are the shear modulus of various mediums. The higher the shear modulus is, the more rigid the solid is. If the solid’s modulus is smaller, it is easier to deform or change its shape. For liquids, the modulus is zero. The table below has two units, GPa (gigapascal) and kg/mm^2. The conversion rate is approximately 1 GPa = 101.9716212978 kg/mm^2.


The values in are from the “What is the Shear Modulus?” article by Dr. Helmenstine (see the Sources section) in GPa.


Shear Modulus

GPa

kg/mm^2

Rubber

0.0006

0.06118297278

Plywood

0.62

63.2224052

Nylon

4.1

418.0836473

Lead

13.1

1335.828239

Aluminum

25.5

2600.276343

Brass

40

4078.864852

Copper

44.7

4558.131472

Titanium

41.1

4191.033635


Source:


Casio. Program Library: FX-702P pp. 71-72 (English)

Helmenstine, Anne Marie, Ph.D. "What Is the Shear Modulus?" ThoughtCo, Feb. 17, 2021, thoughtco.com/shear-modulus-4176406. Retrieved January 21, 2024.

TranslatorsCafe.com “Convert gigapascal [GPa] to kilogram-force/millimeter² [kgf/mm²]”

https://www.translatorscafe.com/unit-converter/en-US/pressure/5-28/gigapascal-kilogram-force/millimeter%C2%B2/ Retrieved January 21, 2024



Eddie


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


Sunday, March 3, 2024

Casio FX-702P and Swiss Micros DM42: Spearman’s Coefficient of Rank Correlation

Casio FX-702P and Swiss Micros DM42: Spearman’s Coefficient of Rank Correlation


Introduction: Correlation of Rankings Between Two Events



The Spearman’s coefficient rank correlation tests the relationship between two variables according to the rank of the two variables. Ranks are assumed to be positive integers; 1 for 1st, 2 for 2nd, 3 for 3rd, etc. The Spearman’s correlation is said to be non-parametric, eliminating the requirement that the data is normally distributed.


The correlation has a range between -1 and +1. Two variables have a strong statistical relationship if the correlation is close to -1 or +1. Conversely, these variables have no relationship if the correlation is equal to 0.


Let the variables A and B be the two variables. Again, A and B are ranks.



Assuming that there are no ties in ranking in either A or B, the correlation is calculated as:


r = 1 - ( 6 × C)^2 ) ÷ (n^3 – n)


where:

C = Σ( (A_i – B_i)^2, k = 1 to n)

n = number of ranks


Casio FX-702P Code

This is a port of the Spearman’s Coefficient of Rank Correlation program set from Casio for the fx-702P. The original BASIC programs are listed here (Casio, pg. 89, Program Library FX-702P, see sources):



P0 (rank input):

10 C=0:N=1

20 PRT “A”;N;:INP A

30 PRT “B”;N;:INP B

40 C=C+(A-B)↑2

50 N=N+1:GOTO 20



P1 (calculate the correlation):

10 N=N-1

20 R=1-6*C/(N↑3-N)

30 PRT “R=”;R

40 END



Note: PRT and INP are shortcut commands for PRINT and INPUT, respectively. The three letter shortcuts are allowed (and encouraged) on the fx-702P.


Swiss Micros DM 42 Code: SPEAR


00 { 119-Byte Prgm }
01▸LBL "SPEAR"
02 "SPEARMAN CORR"
03 AVIEW
04 PSE
05 0
06 STO 03
07 1
08 STO 04
09 "ENTER RANK #S"
10 AVIEW
11 PSE
12▸LBL 00
13 "DONE? XEQ 01"
14 AVIEW
15 PSE
16 "A"
17 ARCL 04
18 ├"?"
19 PROMPT
20 "B"
21 ARCL 04
22 ├"?"
23 PROMPT
24 -
25 X↑2
26 STO+ 03
27 1
28 STO+ 04
29 GTO 00
30▸LBL 01
31 1
32 STO- 04
33 RCL 04
34 3
35 Y↑X
36 RCL- 04
37 1/X
38 RCL× 03
39 6
40 ×
41 +/-
42 1
43 +
44 STO 05
45 "R="
46 ARCL 05
47 AVIEW
48 .END.



Note: ├ is the append string character, call it up by pressing [ (shift) ] { ALPHA } [ ENTER ].


Instructions

1. Sort event A and B to their relative rankings. We are not analyzing data point by their values, but their rankings.

2. Press [ XEQ ] {SPEAR}

3. For each rank of event A, type the rank and press [ R/S ]. For each rank of event B, type the rank and press [ R/S ]. There are prompts to guide rank entry.

4. When done, execute label 01 by pressing [ XEQ ] 01.


Example

Two algorithms A and B are analyzed. The time between run time with algorithms A and B are:

A: 48 seconds, B: 63 seconds

A: 50 seconds, B: 64 seconds

A: 53 seconds, B: 61 seconds

A: 55 seconds, B: 66 seconds

A: 57 seconds, B: 69 seconds


Ranking the times relative to algorithm A are:

A: 48 seconds (rank 1), B: 63 seconds (rank 2)

A: 50 seconds (rank 2), B: 64 seconds (rank 3)

A: 53 seconds (rank 3), B: 61 seconds (rank 1)

A: 55 seconds (rank 4), B: 66 seconds (rank 4)

A: 57 seconds (rank 5), B: 69 seconds (rank 5)



Calculate the Spearman correlation:

XEQ SPEAR

A1? 1 R/S

B1? 2 R/S

A2? 2 R/S

B2? 3 R/S

A3? 3 R/S

B3? 1 R/S

A4? 4 R/S

B4? 4 R/S

A5? 5 R/S

B5? 5 R/S

XEQ 01

Result: R = 0.7000



The Spearman correlation is 0.7.




Sources


“Spearman’s rank correlation coefficient” DATAtab Team (2024). DATAtab: Online Statistics Calculator. DATAtab e.U. Graz, Austria. URL: https://datatab.net Retrieved January 17, 2024.


“Spearman’s rank correlation coefficient” Wikipedia. https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient Edited January 17, 2024. Retrieved January 17, 2024.


Casio. Program Library: FX-702P pg. 89 (English)

(The Casio Ledudu web page, https://casio.ledudu.com/pockets.asp?lg=eng&type=53has the library in French).



Eddie



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


Sunday, May 29, 2022

HP 42S/DM42: Base Programs

 HP 42S/DM42:   Base Programs


Unsigned NOT


The program UNOT applies a NOT to a binary integer (flips zeros to ones and ones to zeros) using unsigned binary integers.  The number of bits (size) is prompted.


HP 42S/DM42 Program UNOT


00  {40-Byte Prgm}

01  LBL "UNOT"

02  BINM

03  "BIN?"

04  PROMPT

05  STO 01

06  EXITALL

07  "SIZE?"

08  PROMPT

09  STO 02

10  2

11  X<>Y

12  Y↑X

13  RCL- 01

14  STO 02

15  1

16  -  

17  BINM

18  END


Examples:


Unsigned NOT of 10100, size 5:  1011  (01011)


Unsigned NOT of 10100, size 8:  11101011


Shift Left


Makes a binary integer shift left: a zero is added to the right side of the integer and "drops" off the left most digit.  The number of bits (size) is prompted.  The binary number is assumed to be non-negative. 


HP 42S/DM42 Program SL16


00  {35-Byte Prgm}

01  LBL "SL16"

02  BINM

03  "BIN?"

04  PROMPT

05  EXITALL

06  2

07  ×

08  "SIZE?"

09  PROMPT

10  2

11  X<>Y

12  Y↑X

13  MOD

14  BINM

15  END


Examples:


Shift Left:  10100, size 5:  1000   (01000)


Shift Left:  10100, size 8:  101000  (00101000)


Shift Right (Logical)


Makes a binary integer shift right: a zero is added to the left side of the integer and "drops" off the left most digit.  The binary number is assumed to be non-negative. A logical shift right divides an integer by 2 and taking the integer result.


HP 42S/DM42 Program SR16


00  {24-Byte Prgm}

01  LBL "SR16"

02  BINM

03  "BIN?"

04  PROMPT

05  EXITALL

06  2

07  ÷

08  IP

09  BINM

10  END


Examples:


Shift Right:  10100:  1010


Shift Right:  1010:  101


The next two programs deals with RGB and HEX codes for computer colors.


HP 42S/DM42 Program CLR→:   RBG to Hexadecimal Code


00  {51-Byte Prgm}

01  LBL "CLR→"

02  DECM

03  "RED?"

04  PROMPT

05  65536

06  BASE×

07  "GREEN?"

08  PROMPT

09  256

10  BASE×

11  BASE+

12  "BLUE?"

13  PROMPT

14  BASE+

15  HEXM

16  END


Example:

Red: 221, Green: 80, Blue 109

Result:  HEX Code:  DD506D


HP 42S/DM42 Program  →CLR:   Hexadecimal to RGB Code


00  {63-Byte Prgm}

01  LBL "→CLR"

02  HEXM

03  "HEX CODE?"

04  PROMPT

05  STO 00

06  DECM

07  65536

08  BASE÷

09  STOP   // Red

10  65536

11  BASE×

12  RCL 00

13  X<>Y

14  BASE-

15  STO 00

16  256

17  BASE÷

18  STOP   // Green

19  256

20  BASE×

21  RCL 00

22  X<>Y

23  BASE-

24  END


Example:  

HEX Code:  103E22

Result:  Red:  16, Green:  62,  Blue:  34


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 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: ...