Memory Exchange
We will introduce another powerful feature of the HP 15C: memory exchange. This will allow the user to exchange the contents of the X register with a designated memory register.
Key strokes: [ f ] [ 4 ] (x > <)
Example: Store 2 in memory register 5. Call the constant π and exchange it with the contents of memory register 5.
Key strokes:
2 [STO] 5 (Display: 2.0000)
[ g ] [EEX] ( π ) (Display: 3.1416)
[ f ] [ 4 ] (x > <) 5 (Display: 2.0000)  now π in in R5
Check: [RCL] [ 5 ] (Display: 3.1416)
We will use this in a program.
Area of a Polygon with Transverse Coordinates
This program calculates the area of a polygon which vertices are given by (x,y) coordinates by the approximation:
R ≈ 0.5 × abs(∑(y_i * x_i+1  y_i+1 * x_i, i = 0, n1))
In geographic terms:
 y > 0, North


x< 0, 
West 

 x > 0, East



 y < 0, South
Labels Used:
LBL A  Initialize the program and enters the initial coordinates
LBL B  Enters additional coordinates
LBL C  Calculates area
Memory Registers Used:
R0 = Area
R1 = x_i
R2 = y_i
R3 = x_i+1
R4 = y_i+1
R5 = temporary use
R6 = temporary use
Program:
KEY CODES KEYS
001 42 21 11 LBL A
002 0 0
003 44 5 STO 5
004 44 6 STO 6
005 33 R ↓
006 44 1 STO 1
007 34 x<>y
008 44 2 STO 2
009 2 2
010 43 32 RTN
011 42 21 12 LBL B
012 44 3 STO 3
013 34 x<>y
014 44 4 STO 4
015 34 x<>y
016 45 20 2 RCLx 2
017 44 40 6 STO+ 6
018 45 4 RCL 4
019 45 20 1 RCLx 1
020 44 40 5 STO+ 5
021 45 3 RCL 3
022 42 4 1 x<>1 * Exchange X with R1
023 45 4 RCL 4
024 42 4 2 x<>2 * Exchange X with R2
025 43 32 RTN
026 42 21 13 LBL C
027 45 5 RCL 5
028 45 30 6 RCL 6
029 43 16 ABS
030 2 2
031 10 ÷
032 44 0 STO 0
033 43 32 RTN
Instructions:
1. Enter the initial y coordinate, hit [ENTER], the initial x coordinate, and press [ f ] [ √ ] (A).
2. For the additional points, enter the y coordinate, press [ENTER], enter the x coordinate, and the [ f ] [e^x] (B).
3. To calculate the area, press [ f ] [10^x] (C).
Example:
Find the area of the polygon with the following vertices:
(0, 0)
(4, 4)
(0, 8)
(2, 8)
(3, 1)
Key Strokes:
0 [ENTER] 0 [ f ] [ √ ] (A)
4 [ENTER] 4 [ f ] [e^x] (B)
8 [ENTER] 0 [ f ] [e^x] (B)
8 [ENTER] 2 [CHS] [ f ] [e^x] (B)
1 [CHS] [ENTER] 3 [CHS] [ f ] [e^x] (B)
[ f ] [10^x] (C)
Area = 37
I hope you find this program useful and fun. Until next time,
Eddie
This tutorial is property of Edward Shore. © 2011
Eddie, great routine! My old (age and former)boss has an original 15c from 1980's. He told me he lost his area program. I will set him up with this. Old surveyors never die they just hang onto their calculators. His original is sahalahow compared to the new circuitry in my LE.
ReplyDeletep.s. I like your approach because it's very efficient.