Saturday, September 15, 2018

HP 20S and 21S: Heron's Triangle

HP 20S and 21S:  Heron's Triangle

Introduction

The following program calculates the area of a triangle knowing the three lengths.  The area is determined by Heron's formula:

Area:  √(s * (s - a) * (s - b) * (s - c)) where s = (a + b + c)/2
Store the lengths of the triangle in registers R0, R1, and R2 respectively.  
Results are stored in the following registers:
R3:  s
R4:  area

HP 20S and 21S Program: Heron's Triangle

The key codes for both calculators are the same.

STEP KEY KEY CODE
01 LBL A 61, 41, A
02 RCL 0 22, 0
03 STO 3 21, 3
04 RCL 1 22, 1
05 STO+3 21, 75, 3
06 RCL 2 22, 2
07 STO+3 21, 75, 3
08 2 2
09 STO÷3 21, 45, 3
10 RCL 3 22, 3
11 STO 4 21, 4
12 RCL 3 22, 3
13 - 65
14 RCL 0 22, 0
15 = 74
16 STO×4 21, 55, 4
17 RCL 3 22, 3
18 - 65
19 RCL 1 22, 1
20 = 74
21 STO×4 21, 55, 4
22 RCL 3 22, 3
23 - 65
24 RCL 2 22, 2
25 = 74
26 STO×4 21, 55, 4
27 RCL 4 22, 4
28 11
29 STO 4 21, 4
30 RTN 61, 26

Example

R0 = 17, R1 = 18, R2 = 21.   Result:  Area:  148.833238744

Note:  I switched computers last week.  For the last few years, I used Microsoft Word but for the time being I am going to use WordPad.  Let's see how this goes.  Fortunately I can still can use Unicode characters with Alt+X.  For example, I can type 221A, then type [Alt] + [ X ] to get the square root character.  Unfortunately, WordPad doesn't have spell check.  

Eddie

All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.


Casio fx-CG50 and Swiss Micros DM32: HP 16C’s Bit Summation

  Casio fx-CG50 and Swiss Micros DM32: HP 16C’s Bit Summation The HP 16C’s #B Function The #B function is the HP 16C’s number of...