Showing posts with label area of an ellipse. Show all posts
Showing posts with label area of an ellipse. Show all posts

Saturday, July 9, 2016

HP 42S Programming Part II: Dew Point, Ellipse Area and Eccentricity, Easy Transverse

HP 42S Programming Part II:  Dew Point, Ellipse Area and Eccentricity, Easy Transverse

Click here for Part I:  Matrix Column Sum, GCD, Error Function

(I plan to post Part III next week.)

As mentioned in Part I, you can download an emulator for the HP 42S, Free42 here: http://thomasokken.com/free42/ .  The emulator is for many operating systems including Windows, Mac, iOS, and Android.  



HP 42S:  Dew Point (°C)


00 {99-Byte Prgm}
01 LBL “DEW”
02 “TEMP °C:”
03 PROMPT
04 STO “T”
05 “HUMIDITY %”
06 PROMPT
07 STO “H”
08 LN
09 17.27
10 RCL* “T”
11 237.3
12 RCL+ “T”
13 ÷
14 +
15 17.27
16 ÷
17 STO “V”
18 237.3
19 RCL* “V”
20 1
21 RCL- “V”
22 ÷
23 “DEW POINT °C”
24 ARCL ST X
25 AVIEW
26 STOP
27 END

Instructions:  Execute GTO DEW from Home.  Press [R/S].

Test:  Input:  T:  20°C, H = 0.50
Result:  9.2696°C

 HP 42S:  Area and Eccentricity of an Ellipse

The program ELLIPSE calculates the area and eccentricity of an ellipse. 

Formulas:
Assume a>b, where a and b represent the lengths of semi-diameters, respectively
Area:  A = π*a*b
Eccentricity:  ϵ = √(1 – (b/a)^2)

00 {76-Byte Prgm}
01 LBL “ELLIPSE”
02 “LARGE S-D:”  \\ S-D:  semi-diameter
03 PROMPT
04 STO “A”
05 “SMALL S-D:” 
06 PROMPT
07 STO “B”
08 RCL “A”
09 RCL* “B”
10 PI  \\ π
11 *
12 “AREA:”
13 AVIEW
14 PSE
15 STOP \\ R/S
16 1
17 RCL “B”
18 RCL÷ “A”
19 X^2
20 –
21 SQRT
22 “ECC:”
23 AVIEW
24 PSE
25 END

HP 42S Easy Transverse

Calculates the new point knowing the original coordinates, direction, and angle of travel.  The angle 0° comes from due east and rotates counterclockwise.  The program sets the HP 42S to degrees mode.  We make use of the Programmable Menu. 

00 {183-Byte Prgm}
01 LBL “EASYTRV”
02 DEG
03 0
04 STO “T”   \\ initialize total distance counter
05 “INITIAL EASTING”
06 PROMPT
07 STO “E”
08 “INIT. NORTHING”
09 PROMPT
10 STO “N”
11 LBL 00 \\ main label
12 XEQ 01 \\ go to calculation sub loop
13 LBL 03 \\ start menu label
14 CLMENU
15 “NEXT”
16 KEY 1 XEQ 01 \\ KEYX command
17 “QUIT”
18 KEY 2 GTO 02 \\ KEYG command
19 MENU
20 STOP
21 GTO 03 \\ end menu loop
22 LBL 01 \\ main calculation loop
23 CLRMENU \\ make both lines available for viewing
24 “ANGLE (0°-360°)”
25 PROMPT
26 STO “A”
27 “DISTANCE”
28 PROMPT
29 STO “D”
30 STO+ “T”
31 →REC
32 STO+ “E”
33 X<>Y
34 STO+ “N”
35 RCL “E”
36 “EAST:”
37 ARCL ST X
38 AVIEW
39 STOP
40 RCL “N”
41 “NORTH:”
42 ARCL ST X
43 AVIEW
44 RTN
45 LBL 2  \\ finalization sub routine
46 CLMENU
47 RCL “T”
48 “ΣDIST:”   \\  Σ is from the ALPHA-MATH menu
49 ARCL ST X
50 AVIEW
51 STOP
52 RCL “N”
53 RCL “E”
54 END

Test:
Initial Data Coordinates:  N = 1,000,  E = 1,000
Travel #1:  170 units at 118°  (28° NW)
Travel #2:  162 units at 45°  (45° NE)

Input:
[XEQ] {EASYT}
1000 [R/S] [R/S]
118 [R/S] 170 [R/S]

Result:
EAST: 920.1898 [R/S],  NORTH: 1,150.1011

{NEXT} 45 [R/S] 162 [R/S]

EAST:  935.5061 [R/S], NORTH:  1,192.4143

{QUIT} ΣDIST:  215 [R/S], N on Y stack, E on X stack. 


 This blog is property of Edward Shore, 2016.


Wednesday, July 6, 2016

TI-55 III Programs Part III: Area and Eccentricity of Ellipses, Determinant and Inverse of 2x2 Matrices, Speed of Sound/Principal Frequency

TI-55 III Programs Part III:  Area and Eccentricity of Ellipses, Determinant and Inverse of 2x2 Matrices, Speed of Sound/Principal Frequency



TI-55 III:  Area and Eccentricity of the Ellipse

Formulas:
Assume a>b, where a and b represent the lengths of semi-diameters, respectively
Area:  A = π*a*b
Eccentricity:  ϵ = √(1 – (b/a)^2)

Program: 
Partitions Allowed: 1-5
STEP
CODE
KEY
COMMENT
00
71
RCL
R0 = a
01
00
0

02
65
*

03
71
RCL
R1 = b
04
01
1

05
65
*

06
91
π

07
95
=

08
12
R/S
Display A
09
53
(

10
01
1

11
75
-

12
53
(

13
71
RCL

14
01
1

15
55
÷

16
71
RCL

17
00
0

18
54
)

19
18
X^2

20
54
)

21
95
=

22
13

23
12
R/S
Display ϵ

Input:  a [STO] 0, b [STO] 1, [RST] [R/S]
Result:  Area, [R/S] Eccentricity

Test:  a = 7.06, b = 3.78
Result: A ≈ 83.839055, ϵ ≈ 0.8445918

TI-55 III:  Determinant and Inverse of 2 x 2 Matrices

This program will require 4 registers. 
Input Matrix:  M = [[ R0,  R1 ] [ R2 , R3 ]]
Output Matrix:  M^-1 = [[ R3/det, -R1/det ] [ -R2/det, R0/det ]]
Where det = R0 * R3 – R1 * R2  (determinant). 

Program: 
Set 4 partitions:  [2nd] [LRN] (Part) 4
STEP
CODE
KEY
COMMENT
00
71
RCL
Calculate determinant
01
00
0

02
65
*

03
71
RCL

04
03
3

05
75
-

06
71
RCL

07
02
2

08
75
*

09
71
RCL

10
01
1

11
95
=

12
12
R/S
Display determinant
13
61
STO
Calculate inverse
14
55
÷

15
00
0

16
61
STO

17
55
÷

18
03
3

19
94
+/-

20
61
STO

21
55
÷

22
01
1

23
61
STO

24
55
÷

25
02
2

26
01
1
Display 1 to indicate “done”
27
12
R/S


Input:  Store:
M(1,1) [STO] 0
M(1,2) [STO] 1
M(2,1) [STO] 2
M(2,2) [STO] 3
Press [R/S] to calculate the determinant of M.  If M≠0, continue and press [R/S].
You will see a 1 in the display, this is used as an indicator that the program is done. 

Result Inverse Matrix:
M^-1[1,1] stored in R3
M^-1[1,2] stored in R1
M^-1[2,1] stored in R2
M^-1[2,2] stored in R0

Test: 
M =  [ [ -1.4,  3.0 ], [ 2.8, 6.4 ] ]
Determinant = -17.36
M^-1 ≈  [ [ -.3686635945, .1728110599 ], [ .1612903226, .0806451613 ] ]

TI-55 III: Speed of Sound/Fundamental Resonant Frequency

Formulas:

Speed of Sound (m/s):  v = t*0.6 + 331.4
Where t = temperature (°C)

Fundamental Resonant Frequencies in an Open Pipe:  fn = v/(2*L)
Where fn = frequency (Hz), v = speed of sound (m/s), L = length of pipe (m)

Program:
Partitions allowed:  1-5
STEP
CODE
KEY
COMMENT
00
65
*

01
93
.
Decimal point
02
06
6

03
85
+

04
03
3

05
03
3

06
01
1

07
93
.
Decimal point
08
04
4

09
95
=

10
12
R/S
Display speed of sound
11
55
÷

12
02
2

13
55
÷

14
12
R/S
Prompt for L
15
95
=

16
12
R/S
Display frequency

Speed of Sound in Dry Air: 
Input:  Enter temperature in °C [F1]
Result:  Speed of sound (m/s), press [R/S]

Fundamental Resonant Frequencies:
Store the length of the open pipe (m) then press [R/S]
Result:  Fundamental Resonant Frequency (Hz)

Test:
Open pipe of 0.45, where the temperature of the air is 39°C (102.2°F). 

Input:  39 [R/S]
Result:  354.8 m/s (speed of sound), [R/S]
394.22222 Hz (fundamental resonant frequency)

Source:  Browne Ph. D, Michael.  “Schaum’s Outlines:  Physics for Engineering and Science”  2nd Ed.  McGraw Hill: New York, 2010

 Eddie

I hope you are enjoying this series of programs for calculators from the 1980s.  The next series, I plan to stay in the 1980s when I work with the 1988 HP 42S.

This blog is property of Edward Shore.  

RPN HP 12C: Fibonacci and Lucas Sequences

  RPN HP 12C: Fibonacci and Lucas Sequences Golden Ratio, Formulas, and Sequences Let φ be the Golden Ratio: φ = (1 + √5) ÷ 2...