Showing posts with label cylinder. Show all posts
Showing posts with label cylinder. Show all posts

Sunday, August 15, 2021

Construction Pro 5: Geometry Algorithms

Construction Pro 5:  Geometry Algorithms


Before We Begin


Before we begin, some things to note:


1.  The [ Circ ] [ Circ ] sequence gives the area of a circle given by the denominator.  Area = (π * diameter^2) / 4 


2.  The [ Conv ] [ Rcl ] will clear the Construction Master 5's memory register.  So will [ Rcl ] [ Rcl ], the only difference is that the former sequence will not recall the memory's contents.


3.  The [ Rcl ] [ M+ ] sequence will recall the memory register's contents.


4.  The Construction Master 5 operates in Chain mode, like standard four-function calculators.  


5.  The algorithms presented today is one way to approach these calculation, most of them demonstrate the [ Circ ] [ Circ ] and memory features.   


Area:  Donut Driveway




Area = ((2D + I)^2 - I^2) * π/4


Key Sequence:


[ Conv ] [ Rcl ]

2 [ x ] D [ + ] I [ = ] [ Circ ] [ Circ ] [ M+ ]

I [ Circ ] [ Circ ] [ Conv ] ( M- )

[ Rcl ] [ M+ ]


Example:

D = 50 feet, I = 10 feet


[ Conv ] [ Rcl ]

2 [ x ] 50 [ Feet ] [ + ] 10 [ Feet ] [ = ] [ Circ ] [ Circ ] [ M+ ]

10 [ Feet ] [ Circ ] [ Circ ] [ Conv ] ( M- )

[ Rcl ] [ M+ ]


Result:  9,424.778 ft^2


Volume:  One-Hole Concrete Block




Note:  The border length (d) is equal around the entire block.


V = ( ( W + L ) * 2 * d - 4 * d^2 ) * t


Key Sequence:


[ Conv ] [ Rcl ]

W [ + ] L [ x ] 2 [ x ] d [ M+ ]

d [ Conv ] ( x^2 ) [ x ] 4 [ M- ]

[ Rcl ] [ M+ ] [ x ] t [ = ]


Example:

L = 12 in, W = 8 in, d = 1 in, t  10 in


[ Conv ] [ Rcl ]

8 [ Inch ] [ + ] 12 [ Inch ] [ x ] 2 [ x ] 1 [ Inch ] [ M+ ]

1 [ Inch ] [ Conv ] ( x^2 ) [ x ] 4 [ M- ]

[ Rcl ] [ M+ ] [ x ] 10 [ Inch ] [ = ]


Result:  360 in^3


Volume: Right Triangular Prism




V = D * H * B / 2 


Key Sequence:


D [ x ] H [ x ] B [ ÷ ] 2 [ = ]


Example:

D = 325 ft, H = 77 ft, B = 148 ft


325 [ Feet ] [ x ] 77 [ Feet ] [ x ] 148 [ Feet ] [ ÷ ] 2 [ = ]


Result:  1,851,850 ft^3 ≈ 68,587.04 yd^3


Volume:  Sphere Using the Circ Function





V = 4/3 * π * r^3 = π * d^3 / 6 = area_circle * d / 1.5

where area_circle = π * d^2 / 4


Key Sequence:


[ Conv ] [ Rcl ]

D [ M+ ] [ = ] [ Circ ] [ Circ ] [ x ] [ Rcl ] [ M+ ] [ ÷ ] 1.5 [ = ]


Note:  The first equals key "locks" in the value of D on to the register and allows it to be picked up with the Circ function without having to re-type it.  


Example:

D = 5 ft


[ Conv ] [ Rcl ]

5 [ Feet ] [ = ] [ M+ ] [ Circ ] [ Circ ] [ x ] [ Rcl ] [ M+ ] [ ÷ ] 1.5 [ = ]


Result: 65.44985 ft^3


Volume:  Column Using the Circ Function



V = π * D^2 * H / 4 = area_circle * H

where area_circle = π * d^2 / 4


Key Sequence:


D [ Circ ] [ Circ ] [ x ] H [ = ]


Example:

D = 2 ft 2 in, H = 1 ft 8 in


2 [ Feet ] 2 [ Inch ] [ Circ ] [ Circ ] [ x ] 1 [ Feet ] 8 [ Inch ] [ = ]


Result:  6.145013 ft^3


Commas added for readability.  


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. 


Friday, December 23, 2016

Fun with HP 71B IV

Fun with HP 71B IV

For the previous entries:

Links to other HP 71B Programs:
Fun with the 71B:
http://edspi31415.blogspot.com/2012/06/fun-with-hp-71b.html
Fun with the 71B III:


Rake Wall

The program RAKEWALL calculates:

*  The positions and lengths of studs on a rake wall
*  Angle of the incline




Program RAKEWALL
192 Bytes, 12/22/2016

10 DESTROY B,R,L,N,A
15 DESTROY I,T,O
50 INPUT “BASE:”; B
52 INPUT “RISE:”; R
54 INPUT “RUN:”; L
56 INPUT “O.C. :”; S
74 N = INT(L/S)
76 DEGREES
78 T = ATAN(R/L)
80 DISP “ANGLE =”; T; “°”  @ PAUSE
90 FOR I=L TO 0 STEP –S
92 A = I*TAN(T)+B
94 DISP I; “, “; A  @ PAUSE
96 NEXT I
98 DISP 0; “, “; B

Notes:
Degree symbol (°):  [ g ], [RUN] (CTRL), [ A ]

Example: (amounts are in feet)
BASE:  4
RISE:  3
RUN:  6
O.C.:  16/12  (1 foot, 4 inches)

Output: 
ANGLE = 26.5650511771 °
(Position from where the incline meets the base, length of studs)
6, 7
4.66666666667, 6.33333333334
3.33333333334, 5.66666666667
2.00000000001, 5
0.66666666668, 4.33333333334
0,  4


Automotive Cylinders:  Calculating Displacement and Piston Speed

The program supplies default values which can be accepted or changed.



Program AUTOCYN
217 Bytes, 12/22/2016

10 DESTROY N,B,S,R,E,P
15 INPUT “# CYLINDERS:”,  “6”; N
20 INPUT “BORE (IN):”, “4”; B
25 INPUT “STROKE (IN):”, “4”; S
30 E = PI/4 * B^2 * S * N
35 INPUT “RPM:”; R
40 P = S * R / 6
45 DISP “ENGINE DISPLACEMENT =” @ WAIT 1
50 DISP E; “ IN^3” @ PAUSE
55 DISP “PISTON SPEED =” @ WAIT 1
60 DIPS P; “FPM”

Example 1:
N = 6 cylinders, B = 4 in, S = 4 in, RPM = 3500
Output:  E ≈ 301.59290 in^3, P ≈ 2333.33333 FPM

Example 2:
N = 6 cylinders, B = 4 in, S = 3 in, RPM = 4500
Output:  E ≈ 226.19467 in^3, P = 2250 FPM

Right Triangle Solver

The program RIGHTTRI is a solver for the sides A, B, and C.  To solve for the third side, the desired side needs to have a 0 value, while the other two sides have non-zero values.  Each time a solution is found, the values of A, B, and C are reset (set to 0).



Program RIGHTTRI
502 Bytes, 12/22/2016

10 DESTROY A,B,C,Z$
11 ! LOOP
12 DISP “A, B, C, Solve, Exit”
14 DELAY 0, 0
16 Z$ = KEY$
18 IF Z$ = “A” THEN 30
20 IF Z$ = “B” THEN 40
22 IF Z$ = “C” THEN 50
24 IF Z$ = “S” THEN 60
26 IF Z$ = “E” THEN 96
28 GOTO 12
30 INPUT “A = “; A
32 GOTO 12
40 INPUT “B = “; B
42 GOTO 12
50 INPUT “C = “; C
52 GOTO 12
60 IF A=0 AND B AND C THEN 62 ELSE 70
62 S=SQR(C^2-B^2) @ Z$ = “A”
64 GOTO 90
70 IF A AND B=0 AND C THEN 72 ELSE 80
72 S=SQR(C^2-A^2) @ Z$ = “B”
74 GOTO 90
80 IF A AND B AND C=0 THEN 82 ELSE 86
82 S=SQR(A^2+B^2) @ Z$ = “C”
84 GOTO 90
86 DISP “MUST HAVE ONE 0” @ BEEP @ WAIT .5
88 GOTO 10
90 DISP Z$; “ = “; S @ PAUSE
92 GOTO 10
94 DISP “DONE”

Notes:

The line of IF A=0 AND B AND C… tests whether A is zero, B and C are non-zero.  You can test whether a variable is non-zero by just typing the variable in an IF condition.

The function SQR is the square root function of the HP 71B.

Anything following an exclamation point (!) is a comment.


Basic Bridged-T Notch Filter

The program NOTCH calculates the required capacitor and resistor to null out an undesired frequency.

Inputs:  inductance (H), frequency to nullified (Hz), resistance of the required coil (Ω)



Source:  Rosenstein, Morton.  Computing With the Scientific Calculator Casio: Tokyo, Japan.  1986.  ISBN-10: 1124161430

Program NOTCH
244 Bytes, 12/22/2016

10 DESTROY L,F,I,C,R
20 DISP “INDUCTANCE” @ WAIT 1
22 INPUT “in H: “; L
24 DISP “FREQUENCY” @ WAIT 1
26 INPUT “in Hz: “; F
28 DISP “COIL’S RESISTENCE” @ WAIT 1
30 INPUT “in Ω: “; I
40 C = 1/(2 * PI^2 * F^2 * L)
42 R = (PI * F * L)^2 / I
44 DISP “NOTCH CAPACITOR” @ WAIT 1
46 DISP C; “ F” @ PAUSE
48 DISP “NOTCH RESISTENCE” @ WAIT 1
50 DISP R; “ Ω”

Notes:
Capital Omega Character (Ω):  [ g ], [RUN] (CTRL), [ Q ]

Example:   L = 0.12 H, F = 1170 Hz, Coil Resistance = 30 Ω
Output: 
NOTCH CAPACITOR ≈ 3.08402 * 10^-7 F
NOTCH RESISTENCE ≈ 6485.04070 Ω


Differential Equations and Half-Increment Solution, Numerical Methods

The program HALFDIFF solves the numerical differential equation

d^2y/dt^2 = f(dy/dt, y, t)  given the initial conditions y(t0) = y0 and dy/dt (t0) = dy0

In this notation, y is the independent variable and t is the dependent variable.

The Method

Let C = f(dy/dt, y, t).  Give the change of t as Δt.

First Step:

With t = t0:
h_1/2 = dy0 + C * Δt/2
y1 = y0 + dy0 * Δt

Loop:

t = t0 + Δt
h_I+1/2 = h_I-1/2 + C * Δt
y_I+1 = y_I +h_I+1/2 * Δt

Repeat as many steps as desired.


Source:  Eiseberg, Robert M.  Applied Mathematical Physics with Programmable Pocket Calculators  McGraw-Hill, Inc:  New York.  1976.  ISBN 0-07-019109-3

Program HALFDIFF
250+ bytes, 12/22/2016

Edit f(A,Y,T) at line 5 where
A = y’(t), Y = y(t),  T = t

5 DEF FNF(A,Y,T) = insert function y’(t), y(t), and t here
10 DESTROY A,Y,D,N,H,T
12 RADIANS
20 INPUT “dY/dX (0) = “, “0”; A
22 INPUT “Y(0) = “, “0”; Y
24 INPUT “DELTA T = “,”1”; D
26 INPUT “TMAX = “,”5”; N
28 T = D
44 H = A + FNF(A,Y,T) * D/2
48 Y = Y + H * D
50 DISP D; “, “;  Y @ PAUSE
70 FOR I = 2 * D TO N STEP D
72 T = I @ A = H
76 H = H + FNF(A,Y,T) * D
78 Y = Y + H * D
80 DISP I; “, “; Y @ PAUSE
82 NEXT I

Example:  y’’(t) = y’(t) + 2 *  t with y’(0) = 0, y(0) = 1, Delta t = 1, Max t = 6
FNF(A,Y,T) = A + 2 * T

Results:

T
Y
1
2
2
8
3
26
4
70
5
168
6
376


  
This blog is property of Edward Shore, 2016.





Sunday, January 25, 2015

HP Prime: Calculator Art

Programs will follow.  Enjoy!   Eddie  

DRAW3DCUBE:  3D Cube - not as easy as it seems.  
DRAW3DCUBE
DRAW3DCYN:  My first one I did this weekend.  This looks like a tall glass of water.


DRAW3DCYN
DRAW3DSPH:  Sphere.  I like the effect the HP Prime does with ARC in a FOR loop.


DRAW3DSPH

DRAW3DWAVE:  I wanted something to be drawn using a sine wave.  


DRAW3DWAVE

DRAWSUNSET - This is probably my favorite, since I like sunsets.  



DRAWSUNSET



Tip:  The HP Prime screen is 318 pixels wide and 240 pixels deep.  If you want to leave room for custom menus, then the canvas is 318 pixels by 218 pixels.  The x axis increases to the right, but unlike the Cartesian plane, the y axis increases downward instead of upward.  

Eddie

-------------
Programs:

DRAW3DCUBE

EXPORT DRAW3DCUBE()
BEGIN
LOCAL t,a,b,c,d,s;
RECT();
// coord
a:=159-50*COS(45°);
b:=109-50*SIN(45°);
c:=159+50*COS(45°)+1;
d:=159-50*SIN(45°);

// drawing
LINE_P(a+50*COS(45°),b-SIN(45°),a,b);
LINE_P(a,b,159,109);
LINE_P(159,109,c,b);
LINE_P(c,b,a+50*COS(45°),b-SIN(45°));

LINE_P(a,b,a,d);
LINE_P(a,d,159,159);
LINE_P(159,159,159,109);

LINE_P(159,159,c,d);
LINE_P(c,d,c,b);

// left/right side shade
FOR t FROM b TO d DO
LINE_P(a,t,159,t+50*SIN(45°),#FF0000h);
LINE_P(c,t,159,t+50*SIN(45°),#FFh);
END;

// top shade
FOR t FROM 1 TO 50 DO
LINE_P(a+t*COS(45°),b-t*SIN(45°),
a+t*COS(45°),b+t*SIN(45°),#FFFF00h);
END;

FOR t FROM 50 DOWNTO 1 DO
LINE_P(c-t*COS(45°),b-t*SIN(45°),
c-t*COS(45°),b+t*SIN(45°),#FFFF00h);
END;

WAIT(0);   // I prefer WAIT(0) to FREEZE;

END;

DRAW3DCYN

EXPORT DRAW3DCYN()
BEGIN
LOCAL t;
HAngle:=0;
RECT();
// cylinder shell
FOR t FROM 0 TO 100 STEP 1 DO

ARC_P(159,70+t,20,0,π,#7DF9FFh);

ARC_P(159,70+t,20,π,2*π,#1560BDh);
END;
// sides
LINE_P(139,70,139,170,#1560BDh);
LINE_P(179,70,179,170,#1560BDh);
ARC_P(159,70,20,0,2*π,#1560BDh);
WAIT(0);

END;



DRAW3DSPH

EXPORT DRAW3DSPH()
BEGIN
// 2015-01-22
LOCAL t;
RECT();

// sphere loop
FOR t FROM 100 DOWNTO 1 DO
ARC_P(159,109,t,0,2*π,#808080h);
END;

// outside
FOR t FROM 59 TO 259 DO
PIXON_P(t,−.0025*t^2+.795*t+70.975);
END;

WAIT(0);

END;

DRAW3DWAVE

EXPORT DRAW3DWAVE()
BEGIN
LOCAL t,a,b;
RECT();
HAngle:=0;

FOR t FROM 0 TO 318 DO
a:=25*SIN(3.95168887244ᴇ−2*t-π)+100;
b:=a+25;
PIXON_P(t,a,#FFh);
PIXON_P(t,b,#FFh);

LINE_P(t,a+1,t,b-1,#87CEEBh);
LINE_P(t,b+1,t,218,#964B00h);

END;

LINE_P(0,100,0,125,#FFh);
LINE_P(318,100,318,125,#FFh);

LINE_P(0,125,0,218,#D4AF37h);
LINE_P(318,125,318,218,#D4AF37h);
LINE_P(0,218,318,218,#D4AF37h);

WAIT(0);

END;



DRAWSUNSET

EXPORT DRAWSUNSET()
BEGIN

RECT(#87CEEBh);
LOCAL t,a,b;
HAngle:=0;

// sun
FOR t FROM 50 DOWNTO 40 DO
ARC_P(159,109,t,0,2*π,#FFA500h);
END;
FOR t FROM 40 DOWNTO 0 DO
ARC_P(159,109,t,0,2*π,#FFFF00h);
END;

// horizon
LINE_P(0,108,318,108);


// ground and water
FOR t FROM 0 TO 159 DO
a:=1.855525955687ᴇ−4*t^3
-5.05717802449ᴇ−2*t^2
+3.67070350319*t+109;
LINE_P(t,a,t,109,#80h);
LINE_P(t,a+1,t,242,#964B00h);
END;

FOR t FROM 159 TO 318 DO
a:=1.23858063728ᴇ−4*t^3
-9.61799073419ᴇ−2*t^2
+23.6382711212*t
-1664.83052851;
LINE_P(t,a,t,109,#80h);
LINE_P(t,a+1,t,242,#964B00h);
END;

// lines
LINE_P(120,111,188,111,#C0C0C0h);
LINE_P(125,113,183,113,#C0C0C0h);
LINE_P(130,115,178,115,#C0C0C0h);
LINE_P(135,117,173,117,#C0C0C0h);

WAIT(0);
END;


This blog is property of Edward Shore.  2015



Spotlight: Akron Brass FireCalc Pocket Computer

Spotlight: Akron Brass FireCalc Pocket Computer Welcome to a special Monday Edition of Eddie’s Math and Calculator blog. Thi...