Showing posts with label Sharp EL-5500III. Show all posts
Showing posts with label Sharp EL-5500III. Show all posts

Saturday, September 25, 2021

Sharp EL-5500III & PC-1403: Spin a Wheel and Random Samples

 Sharp EL-5500III & PC-1403:  Spin a Wheel and Random Samples


Spin a Wheel

With the use of the WAIT command, a FOR loop, and an array of strings, we can simulate the spin of a wheel of a random number of steps.  

Note, any variable can be designated a string by adding a dollar sign to the letter, for example A stores a real number, while A$ is a string. 

In an array, A(n-1) has n elements, designated A(0) to A(n-1).  Example:  A(3) has three elements, A(0), A(1), and A(2).

The program presented has a 12 space wheel.  

Sharp EL-5500III/PC-1403 Program:  Spin a Wheel
RUN 900 (or whatever line you designate)

900 DIM A$(11): REM SPIN THE WHEEL
903 N=15 + RND(30)
906 I=RND(12)-1: REM POINTER
909 REM RND(N) GETS 1 TO N
910 A$(0)="$  500"
911 A$(1)="$  650"
912 A$(2)="$  600"
913 A$(3)="$  800"
914 A$(4)="$  750"
915 A$(5)="LOST TURN"
916 A$(6)="$  900"
917 A$(7)="BONUS PRIZE"
918 A$(8)="$  550"
919 A$(9)="$  700"
920 A$(10)="$1,000"
921 A$(11)="  BROKE"
930 WAIT 30: PRINT "SPIN!"
933 FOR J=1 TO N
936 WAIT 20: PRINT A$(I)
939 I=I+1
942 IF I>11 THEN LET I=0
945 NEXT J
946 REM WAIT W/O TIME RESETS PRINT
948 WAIT: PRINT "YOUR SPIN: ";A$(I)
951 END

RUN 900 in RUN mode will show you a wheel spinning.  One of the best results:  "YOUR SPIN: $1,000".   Good luck and have fun!

Random Sample

This program generates an array from a random sample of integers from 1 to N without replacement.  

To save room, a single array is created and an iterative search is made to check to leave out duplicates.   This will increase the time needed to generate longer lists.

Sharp EL-5500III/PC-1403 Program: Random Sample
RUN 1000 (or whatever line you designate)

1000 PRINT "RANDOM SAMPLE"
1003 INPUT "1 TO N. N? "; N 
1006 INPUT "SIZE? "; S
1009 DIM L(S-1)
1012 FOR I=0 TO S-1
1015 R=RND(N)
1018 REM CHECK
1021 FOR J=0 TO I
1024 IF L(J)=R THEN 1015
1027 NEXT J
1030 L(I)=R
1033 PRINT "L("; I; "): "; R
1036 NEXT I
1039 PRINT "RESULT IN ARRAY L"
1042 END

Example:
Choose 10 numbers from 1 to 45.  

1 TO N.  N?:  45
SIZE? 10

A result (your results will vary):
L(0): 9
L(1): 5
L(2): 8
L(3): 4
L(4): 41
L(5): 26
L(6): 42
L(7): 11
L(8): 10
L(9): 28
RESULTS IN ARRAY L

Swiss Micros DM41X Month:  October 2021

Every Saturday in October 2021 will feature the wonderful Swiss Micros DM41X (which programs will apply to the DM41X, DM41L, and the classic HP 41C family).   See you on the next series! 


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, September 18, 2021

Sharp EL-5500III & PC-1403: Complex Number Arithmetic and Vectors

 Sharp EL-5500III & PC-1403:  Complex Number Arithmetic and Vectors


Complex Number Arithmetic

This program calculates the four arithmetic functions for complex numbers in the form of x + i*y, where i = √-1.

Sharp EL-5500III/PC-1403 Program:  Complex Number Arithmetic
RUN 600 (or whatever line you designate)

600 PRINT "COMPLEX ARITHMETIC"
603 INPUT "A? "; A, "Bi? "; B, "C? "; C, "Di? "; D
606 INPUT "1:+ 2:- 3:* 4:/ :"; H
609 IF H=1 THEN 630
612 IF H=2 THEN 640
615 IF H=3 THEN 650
618 IF H=4 THEN 660
621 GOTO 606
630 PRINT A+C; "+ "; B+D; "i": END
640 PRINT A-C; "+ "; B-D; "i": END
650 PRINT A*C-B*D; "+ "; B*C+A*D; "i": END
660 W=(C^2+D^2)
663 PRINT (A*C+B*D)/W; "+ "; (B*C-A*D)/W; "i": END

Example

a + bi = 8 + 3i;  c + di = -4 + 2i
Add: 4 + 5i
Subtract: 12 + 1i
Multiply: -38 + 4i
Divide:  -1.3 + -1.4i

Vectors

This program calculates the dot product, cross product, and the angle between of two vectors.   

Sharp EL-5500III/PC-1403 Program:  Vectors
RUN 800 (or whatever line you designate)

800 PRINT "TWO VECTORS"
803 DIM A(2): DIM B(2)
806 INPUT "A0? "; A(0), "A1? "; A(1), "A2? "; A(2)
809 INPUT "B0? "; B(0), "B1? "; B(1), "B2? "; B(2)
812 INPUT "1.DOT 2.CROSS 3.ANGLE :"; H
815 IF H=1 THEN 830
818 IF H=2 THEN 840
821 IF H=3 THEN 850
824 GOTO 812
830 D=A(0)*B(0)+A(1)*B(1)+A(2)*B(2)
832 PRINT "DOT = ";D : END
840 DIM R(2): R(0)=A(1)*B(2)-A(2)*B(1)
842 R(1)=A(2)*B(0)-A(0)*B(2)
844 R(2)=A(0)*B(1)-A(1)*B(0)
846 PRINT "R0:";R(0) :PRINT "R1:";R(1) :PRINT "R2:";R(2)
848 END
850 X=√(A(0)^2+A(1)^2+A(2)^2)
852 Y=√(B(0)^2+B(1)^2+B(2)^2)
854 D=A(0)*B(0)+A(1)*B(1)+A(2)*B(2)
856 N= ACS (D/(X*Y))
858 PRINT "ANG = "; N: END

Example (Degrees mode set)

A:  A(0) = 4, A(1) = -3, A(2) = 2
B:  B(0) = 6, B(1) = 7, B(2) = -1
Dot:  1
Cross: R(0) = -11, R(1) = 16, R(2) = 46
Angle:  88.85263015°

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, September 11, 2021

Sharp EL-5500 III & PC-1403: Fan Laws and Voltage Drop Percentage

 Sharp EL-5500 III & PC-1403: Fan Laws and Voltage Drop Percentage



Fan Laws 

The program will calculate RPM_new (Revolutions per Minute), SP_new (Static Pressure), and BHP_new (Brake Horsepower).  

Inputs:
CFM_old:  Cubic Feet of Minute - old
CFM_new:  Cubic Feet of Minute - new
RPM_old:  Revolutions per Minute - old
SP_old:  Static Pressure - old
BHP_old:  Brake Horsepower - old

Outputs:
RPM_new
SP_new
BHP_new

Sharp EL-5500III/PC-1403 Program:  Fan Laws
RUN 700 (or whatever line you designate)

700 PRINT "FUN LAWS"
703 INPUT "CFM.OLD? "; A
706 INPUT "CFM.NEW? "; B
709 INPUT "RPM.OLD? "; C
712 INPUT "SP.OLD? "; E
715 INPUT "BHP.OLD? "; G
718 D = B*C/A
721 F = E*B^2/A^2
724 H = G*B^3/A^3
727 PRINT "RPM.NEW: "; D
730 PRINT "SP.NET: "; F
733 PRINT "BHP.NEW: "; H
736 END

Example

Inputs:
CFM.OLD:  1250 CFM
CFM.NEW: 1600 CFM
RPM.OLD:  840 RPM
SP.OLD: 4 in
BHP.OLD: 7 BHP

Results:
RPM.NEW: 1075.2 RPM
SP.NEW: 6.5536 in
BHP.OLD:  14.680064 BHP

Source:
Calculated Industries "Sheet Metal/HVAC Pro Calc User's Guide" 2021

Voltage Drop Percentage

This program calculates the voltage drop percentage for wires that operate in 75°C, given the wire length from the object to the power source for wires 2, 4, 6, 8, 10 and 12.  The NEC 2020 code is used.  

Sharp EL-5500III/PC-1403 Program:  Voltage Drop Percentage
RUN 500 (or whatever line you designate)

500 PRINT "VOLTAGE DROP 75 DEG"
501 CLEAR
503 DIM S(5)
506 REM NEC 2020
509 S(0) = .194
510 S(1) = .308
511 S(2) = .491
512 S(3) = .778
513 S(4) = 1.24
514 S(5) = 1.98
530 INPUT "VOLTS? "; V
533 INPUT "CURRENT? "; A
536 INPUT "WIRE LGTH TO PWR (FT)? "; L
539 INPUT "#2,4,6,8,10,12? "; J
542 J = J/2 - 1
545 W = S(J)
548 D = (A*W/1000*2*L) / V * 100
551 PRINT "VD = "; D; "%"
554 END

Example

Inputs: 
VOLTS:  80 V
CURRENT: 36 A
WIRE LGTH TO PWR (FT): 140 ft 
#8 wire

Result: 
VD = 9.8028%

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, September 4, 2021

Sharp EL-5500III & PC-1403: Stairs and Air Density and Viscosity

 Sharp EL-5500III & PC-1403:  Stairs and Air Density and Viscosity


Stairs


Inputs:

RISE:  The floor-to-floor rise of the staircase. 

MAX RISER HGHT:  The maximum allowable rise height.

TREAD WIDTH:  The desired tread width of each stair.


Outputs:

N:  Number of Stairs

TRUE RH:  True riser height of the stair

# TREADS:  Number of treads

RUN:  Total theoretical run from the first stair to the top.

INCLINE:  Incline of the stair in degrees

STRINGER:  Length of the stringer


All amounts are assumed to be in inches and all amounts are precise (no rounding to the nearest 1/8th inch or 1/16 inch, etc).


Sharp EL-5500III/PC-1403 Program:  Stairs

RUN 300 (or whatever line you designate)


300 PRINT "STAIRS"

303 DEGREE

306 INPUT "RISE (IN)? "; R

309 INPUT "MAX RISER HGHT? "; H

312 INPUT "TREADWIDTH? "; W

315 N = INT (R/H) + 1

318 PRINT "N = "; N

321 T = R/N

324 PRINT "TRUE RH = "; T; " IN"

327 E = N-1

330 PRINT "# TREADS = "; E

333 U = E*W

336 PRINT "RUN = "; U; " IN"

339 A = ATN (T/W)

342 PRINT "INCLINE = "; A

345 S = (E*W)/(COS A)

348 PRINT "STRINGER = "; S; " IN"

351 END


Example


Inputs:

RISE:  150 in   (12 ft 6 in)

MAX RISER HGHT: 7.5 in 

TREAD WIDTH:  12 in


Results:

N = 21

TRUE RH = 7.142857143 IN

# TREADS = 20

RUN = 240 IN

INCLINE = 30.76271954

STRINGER = 279.2994151 IN


Air Density and Viscosity


Inputs:

AIR (F):  Temperature of the air in degrees Fahrenheit (°F)

PRESSURE:  Air pressure in pounds per square inch (psia)


Outputs:

DENSITY:  Air density  (lbm/ft^3)

VISCOSITY:  Estimate of air viscosity (ft^2/sec)


The dynamic viscosity (μ) for air is estimated by the equation to three significant digits:


μ ≈ 5.550736842 * 10^-10 * F + 3.04406316 * 10^-7 


Table of viscosity values:  https://www.engineeringtoolbox.com/air-absolute-kinematic-viscosity-d_601.html


Sharp EL-5500III/PC-1403 Program:  Air Density and Viscosity

RUN 400 (or whatever line you designate)


400 PRINT "AIR DENSITY/VISC (US)"

403 INPUT "AIR (F)? "; F

406 INPUT "PRESSURE (PSIA)? ";R

409 D = (144*R) / (53.3533 * (F+459.67))

412 REM MU - 3 DEC APPROX

415 M = 5.550736842E-10*F + 3.404406316E-7

418 REM NEED 9 PLACES SINCE MU IS TO -6TH POWER

421 M = INT (M*TEN 9) / TEN 9

424 V = M*32.1740464/D

427 PRINT "DENSITY = ": PRINT D; " LBM/FT^3"

430 PRINT "VISCOSITY = ": RINT V; "FT^2/SEC"

433 END


Example


Inputs:

AIR (F):  78 °F

PRESSURE:  82 psia


Outputs:

DENSITY:  4.116226392E-01 LBM/FT^3

VISCOSITY:  2.993678821E-05 FT^2/SEC


Sources


"Air - Dynamic and Kinematic Viscosity".  The Engineering Toolbox   

https://www.engineeringtoolbox.com/air-absolute-kinematic-viscosity-d_601.html

Retrieved July 8, 2021


Lindeburg, Michael R. PE Practice Problems for the Civil Engineering PE Exam: A Companion to the Civil Engineering Reference Manual  Thirteenth Edition Professional Publications, Inc: Belmont, CA  2012


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. 


HP 48G Collection

 HP 48G Collection  Contents:  Intensity of Spherical Light Source  Speed of Light in Dry Air  Pressure of Air  Earth's Gravity a...