Showing posts with label HP 27S. Show all posts
Showing posts with label HP 27S. 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.


Saturday, November 25, 2023

HP 15C, DM42, HP 27S: Floor and Ceiling Functions

HP 15C, DM42, HP 27S:   Floor and Ceiling Functions


(Updated on 12/22/2023 - see note below for the HP 15C versions)


Notes :


HP 15C: includes  HP 15C, Original, Limited, and Collector's Edition, and apps

DM42: includes HP 42S, DM42, Free42, Plus42




Introduction:  Floor and Ceiling Functions


The floor and ceiling functions are two common functions that transfers a number to an integer.   



Floor Function



Floor:   The greatest integer that is less than or equal to x.  A common symbol for floor is |_x_| and a function call is floor(x).


Let int(x) be the integer part function (sometimes labeled intg(x) or lp(x)), and frac(x) be the fractional part function (sometimes labeled fp(x)).


#  x is an integer

If frac(x) = 0, then return floor(x) =  x     


# x is not an integer

If x ≥ 0, then return floor(x) = int(x)

If x < 0, then return floor(x) = int(x) - 1


Per the function.wolfram.com web page: an equivalent using the modulus function for floor(x) is:


floor(x) = x - x mod 1


Examples:


floor(2.8) = 2

floor(6) = 6

floor(-2.8) = -3



Ceiling Function


Ceiling:  The least integer that is greater than or equal to x.  A common symbol for ceiling is |-x-| (except the horizontal lines are the top) and a function call is either ceil(x) or ceiling(x).  


#  x is an integer

If frac(x) = 0, then return ceil(x) =  x     


# x is not an integer

If x ≥ 0, then return ceil(x) = int(x) + 1

If x < 0, then return ceil(x) = int(x) 


Per the function.wolfram.com web page: an equivalent using the modulus function for floor(x) is:


ceil(x) = x + (-x) mod 1


Examples:

ceil(2.8) = 3

ceil(6) = 6

ceil(-2.8) = -2



Calculator Code:  HP 15C, DM 42, HP 27S



HP 15C


This program is NOT accurate for -1 < x < 0 (such as x = -0.5).  Gratitude to Werner for alerting me of this.  (12/22/2023)


Three labels are used:

D:  floor function

E:  ceiling function

1:  used in calculation for both  (roll stack down one extra time when frac(x)≠0)


step #:  key code : key


000:  42, 21, 14:  LBL D

001:  __, __, 36:  ENTER

002:  __, 42, 44:  FRAC

003:  __, 43, 20:  x=0

004:  __, 22, _1:  GTO 1

005:  __, __, 33:  R↓

006:  __, 43, 44:  INT

007:  43, 30, _3:  TEST 3  (x≥0)

008:  __, 43, 32:  RTN

009:  __, __, _1:  1

010:  __, __, 30:  -

011:  __, 43, 32:  RTN


012:  42, 21, 15:  LBL E

013:  __, __, 36:  ENTER

014:  __, 42, 44:  FRAC

015:  __, 43, 20:  x=0

016:  __, 22, _1:  GTO 1

017:  __, __, 33:  R↓

018:  __, 43, 44:  INT

019:  43, 30, _2:  TEST 2 (x<0)

020:  __, 43, 32:  RTN

021:  __, __, _1:  1

022:  __, __, 40:  +

023:  __, 43, 32:  RTN


024:  42, 21, _1:  LBL 1

025:  __, __, 33:  R↓

026:  __, 43, 32:  RTN






DM42/Free 42/HP 42S


00 { 16-Byte Prgm }

01▸LBL "FLOOR"

02 ENTER

03 ENTER

04 1

05 MOD

06 -

07 RTN

08 END


00 { 15-Byte Prgm }

01▸LBL "CEIL"

02 ENTER

03 +/-

04 1

05 MOD

06 +

07 RTN

08 .END.



HP 27S


FLOOR=X-MOD(X:1)


CEIL=X+MOD(-X:1)



Sources


Wolfram Research, Inc.   "Floor Function".  Path:  Integer Functions > Floor[z] > Representations through equivalent functions > With related functions.   Retrieved October 30, 2023.


https://functions.wolfram.com/IntegerFunctions/Floor/27/01/05/



Wolfram Research, Inc.   "Ceiling Function".  Path:  Integer Functions > Ceiling[z] > Representations through equivalent functions > With related functions.   Retrieved October 30, 2023.


https://functions.wolfram.com/IntegerFunctions/Ceiling/27/01/05/




Eddie


All original content copyright, © 2011-2023.  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, October 29, 2022

Plus42 Solver: Derivatives

Plus42 Solver: Derivatives 




Introduction


The Technical Applications book for the HP 27S and HP 19B (and can apply to the HP 17B outside of trigonometry) shows the numerical first and second derivative can be calculated by the formulas:


f ' (x) = (f(x+h) - f(x-h)) / (2 * h)


f ' ' (x) = (f(x + h) - 2 * f(x) + f(x + h)) / h^2 


where h is sufficiently small, like 10^-5 to 10^-12.



Legacy Formulas vs. Plus42 Formulas 


The formulas suggested by the Technical Applications Book are:


First Derivative:



Second Derivative:


Depending on the function FX, this above can turn the above into long equations.  With the ability of user functions, this allows us to use the original definitions.


FX(X): f(x) (insert f(x)


First Derivative:


F'X=(FX(X+H)-FX(X-H))÷(2×H)


Second Derivative:


F''X=(FX(X+H)-2×FX(X)+FX(X-H))÷SQ(H)


SQ:  press by the key sequence [(shift)] (x^2)


':  (ALPHA) [ ↓ ] (PUNC) [ ↓ ] ( ' )


Note:  Radians mode 



Examples 


FIX 5 mode is set.


Example 1:


f(x) = 0.5 * cos(3*x)

x = π/4


FX(X):0.5×COS(3×X)

f'(x) ≈ -1.06066

f''(x) ≈ 3.18198


Example 2:


f(x) = (x^2 + 3*x + 5) / (4*x - 1)

x = 2


FX(X):(X^2+3×X+5)÷(4×X-1)

f'(x) ≈ -0.22449

f''(x) ≈ 0.54227



Functions with Variable Constants


It is easy to expand the user function FX to include variable constants.  For example:


f(x) = -ln(cos(√(a*x)))

Calculate the value and first derivative at x = 0.11 and a = 0.46


Attach variable constants at the end of FX:


FX(X:A):-LN(COS(SQRT(A×X)))

F'X=(FX(X+H:A)-FX(X-H:A))÷(2×H)


f(x:a) ≈ 0.02552

f'(x:a) ≈ 0.23396


The user function makes the calculating numerical derivatives easier.  


Source:


Technical Applications: Step-by-Step Solutions for Your HP-27S or HP-19B Calculator Hewlett Packard.   Edition 2.  Corvallis, OR.   November 1988.  pg. 44


Have any Halloween plans?  Wishing you a great day,


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. 


Sunday, January 9, 2022

Fun With The HP 27S

Fun With The HP 27S


Notes:


*  The HP 27S is set to FIX 4


*  Since none of the formulas have trigonometric functions, they can also be programmed on the HP 17B and HP 17BII+


Partial Fraction Decomposition


(A ∙ x + B)÷((x + C) ∙ (x + D)) = R÷(x + C) + S÷(x + D)


Inputs:  A, B, C, D

Outputs:  R, S


Formula:


PARTFRAC2:(A+B+C+D)×0=IF(S(R):(B-C×A)÷(D-C)-R:(B-D×A)÷(C-D)-S)


Example:  (4 ∙ x + 3) ÷ ((x - 5) ∙ (x + 1))

A = 4, B = 3, C = -5, D = 1

Results:  R = 3.8333, S = 0.1667


Use that the 0×(var1+var2+...) to set an order of variables in the solver.  


2 x 2 Simultaneous Equations


A ∙ x + B ∙ y = C

D ∙ x + E ∙ y = F


The solutions are:


x = (C ∙ E - B ∙ F) ÷ (A ∙ E - B ∙ D)

y = (A ∙ F - C ∙ D) ÷ (A ∙ E - B ∙ D)


Formula:


SIM2X2:0×(A+B+C+D+E+F+L(M:A×E-B×D))=IF(S(X):(C×E-B×F)÷G(M)-X:(A×F-C×D)÷G(M)-Y)


Example:  2x + 3y =5, -3x + 8y = -8

A = 2, B = 3, C = 5, D = -3, E = 5, F = -8

Results:  X = 2.5789, Y = -0.0526


Floor Function


floor(x):  the greatest integer less than or equal to x


floor(x):

If frac(x) = 0 Then return x

 Else If x≥0, then return intg(x) else return intg(x)-1


Formula:


FLOOR=IF(FP(X)=0:X:IF(X>=0:IP(X):IP(X)-1))


Examples:

X = 2.38, FLOOR = 2.0000

X = -9.21, FLOOR = -10.0000


Ceiling Function


ceil(x):  the least integer greater than or equal to x


ceil(x):

If frac(x) = 0 Then return x

  Else If x≥0, then intg(x)+1 else return intg(x)


Formula:


CEIL=IF(FP(X)=0:X:IF(X>=0:IP(X)+1:IP(X)))


Examples:

X = 2.38, CEIL = 3.0000

X = -9.21, CEIL = -9.0000


Rydberg Formula


The Rydberg formula measures the light's wavelength when an electron moves between energy quantum numbers (from higher to lower levels).  The Rydberg formula is to be used for simple atoms only, and is most used for hydrogen atoms.


1/λ = R ∙ Z^2 ∙ (1/n1^2 - 1/n2^2)


R = Rydberg's Constant ≈ 1.097373157 × 10^7 m^(-1)

Z = atomic number, 1 for hydrogen

n1, n2:  energy levels


Formula:


RYDBERG:INV(L)=1.09737316E7×SQ(Z)×(INV(SQ(N1))-INV(SQ(N2)))


N2 > N1


Example:

The energy of an hydrogen election from level 4 to level 2.  Z = 1

Z =1,  N1 = 2, N2 = 4

Result:  L = 4.8601E-7


Source:

Helmenstine, Todd. "What Is the Rydberg Formula and How Does It Work?" ThoughtCo, Aug. 28, 2020, https://www.thoughtco.com/what-is-the-rydberg-formula-604285   Retrieved November 4, 2021



Moment of Inertia - Circular Ring


D$OUT:  outside diameter

D$IN:  insider diameter.  For a circle, set D$IN = 0

I: moment of inertia


Formula:


I=PI×(D$OUT^4-D$IN^4)÷64


Examples:


Circular Ring:

D$OUT = 6.2, D$IN = 1.9;  I = 71.8935


Circle:

D$OUT = 6.2, D$IN = 0; i = 72.5332


Source:

"Properties Of Annual Sections" HP-19C/HP-29C Solutions: Civil Engineering  Hewlett-Packard.  1977



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. 


Sunday, December 5, 2021

HP 17B and HP 27S: Using the Solver for Recursive Functions

HP 17B and HP 27S: Using the Solver for Recursive Functions


Introduction


A simple store and recall procedure can be used with the solver.   


One Initial Condition


u_n = f(u_n-1) with the initial condition u_0


Let B = u_n and A = u_n-1, set up the solver as:


B = F(A)


Initial condition:

u_0 ( A ) ( B )


Subsequent calculations:

[ RCL ] ( B )* [ STO ] ( A ) ( B )


*RCL B is not necessary if you go straight to the next calculation.  


Example:   

u_n = 4*u_n-1 - 3, u_0 = 3


Setup:  B=4×A-3


3 ( A ) ( B )

Result:  9


[ RCL ] ( B) [ STO ] ( A ) ( B )

Result:  33


[ RCL ] ( B) [ STO ] ( A ) ( B )

Result:  129


[ RCL ] ( B) [ STO ] ( A ) ( B )

Result:  513



Two Initial Conditions


u_n = f(u_n-1, u_n-2) with the initial conditions u_0 and u_1


Let C = u_n, B = u_n-1, and A = u_n-2 and set up the solver as:


C = F(A, B)


Initial condition:

u_0 ( A ) u_1 ( B )  ( C )


Subsequent calculations:

[ RCL ] ( B )* [ STO ] ( A ) ( B )


Example:


The Fibonacci Sequence:

u_n = u_n-1 + u_n-2; with u_0 = 1, u_1 = 1


Setup:  C=B+A


1 ( A ) 1 ( B ) ( C )

Result: 2


[ RCL ] ( B ) [ RCL ] ( A ) ( C )

Result:  3



[ RCL ] ( B ) [ RCL ] ( A ) ( C )

Result:  5


[ RCL ] ( B ) [ RCL ] ( A ) ( C )

Result:  8


Nothing to it.


Eddie 


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

HP 17B and HP 27S: Derivatives to the Nth Order (and TI-84 Plus CE Python 5.7 update)

 HP 17B and HP 27S: Derivatives to the Nth Order


With the Solver of the HP 17B family, HP 27S, and the HP 19B calculator, we can calculate derivatives of any order.  Four derivatives are presented here.  You can use any name you want other than those presented here.  Each derivative is to the kth order. 


Derivative 1:   d^k/dx^k a × x^n 


N and K must be positive integers, D is the value of the derivative  


DER1: D=A×X^(N-K)×PERM(N:K)


Example:

Input:  N = 2, K = 1, A = 3, X = 1.5

Result:  D = 9


Derivative 2:   d^k/dx^k e^(a × x) 


K must be a positive integer, D is the value of the derivative


DER2: D=A^K×EXP(A×X)


Example:

Input:  A = 1.8, K =3, X = 3

Result:  D = 213.4409


Derivatives 3 and 4 will require trigonometric functions, which are not available on the HP 17B family.   It is recommended you set the calculator to Radian angle mode.


Derivative 3:  d^k/dx^k sin(a × x)


DER3: D=IF(MOD(K:2)=0:(-1)^(K÷2)×A^K×SIN(A×X):(-1)^((K+3)÷2)×A^K×COS(A×X))


Examples:

Input:  A = 0.75, X = 0.66, K = 2

Result: D = -0.2672


Input:  A = 0.75, X = 0.66, K = 3

Result: D = -0.3712


Derivative 4:  d^k/dx^k cos(a × x)


DER4: D=IF(MOD(K:2)=0:(-1)^(K÷2)×A^K×COS(A×X):(-1)^(K÷2+1÷2)×A^K×SIN(A×X))


Examples:

Input:  A = 0.75, X = 0.66, K = 2

Result: D = -0.4950


Input:  A = 0.75, X = 0.66, K = 3

Result: D = 0.2004


Eddie


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


Tuesday, March 26, 2019

HP 17BII and HP 27S: Quadratic Formula

HP 17BII and HP 27S:  Quadratic Formula


The following solver equations solve the quadratic equation

A*x^2 + B*x + C = 0

by the famous Quadratic Formula

x = (-B ± √(B^2 - 4*A*C) ) / (2*A)

Define D as the discriminant:  D = B^2 - 4*A*C

If A, B, and C are real numbers and:

D<0, the roots are complex conjugates

D≥0, the roots are real roots

Quadratic Equation:  Real Roots Only

QUAD:X=INV(2*A)*(-B+SQRT(B^2-4*A*C)*SGN(R#))

Input Variables:
A:  coefficient of X^2
B:  coefficient of X
C:  constant
R#:  -1 or 1

Output Variables: 
X:  root

Example:  2X^2 + 3X - 5 = 0

Input:
A: 2
B: 3
C: -5
R#: 1 (or any positive number)

Output:
X = 1

Input:
R#: -1

Output:
X = -2.5

Quadratic Equation:  Real or Complex Roots
(Let (L) and Get (G) functions required)

QUAD:0*(A+B+C+L(D:B^2-4*A*C)+L(E:2*A))
+IF(S(X1):IF(D<0:-B÷G(E):(-B+SQRT(D))÷G(E))-X1:0)
+IF(S(X2):IF(D<0:SQRT(ABS(D))÷G(E):(-B-SQRT(D))÷G(E))-X2:0)

 Input Variables:
A:  coefficient of X^2
B:  coefficient of X
C:  constant

Output Variables:
D:  Discriminant 
If D<0:  X1:  real part, X2:  imaginary part
If D≥0:  X1:  real root 1, X2:  real root 2

Example 1:  -3*X^2 + 8*X - 1= 0

Input:
A: -3
B: 8
C: -1

Output:
D = 52
X1 = 0.1315
X2 = 2.5352

Roots:  x = 0.1315, x = 2.5352

Example 2:  3*X^2 + 5*X + 3 = 0

Input: 
A: 3
B: 5
C: 3

Output:
D = -11
X1 = -0.8333
X2 = 0.5528

Roots:  x = -0.8333 ± 0.5528i

Eddie

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

Python in Numworks: Duplicating and Grayscale

Python in Numworks: Duplicating and Grayscale All three scripts presented today use the math, random, and the Numworks specific ...