# HP Forums

Full Version: (11C) Tree Heights
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This program was adapted from the Hand-Held-Calculator Programs
for the Field Forester.

More detail information attached here.

Procedure:

1. Enter slope distance to base of tree [A] -->Display known distance

2. Enter Slope percent to tip, [R/S] --> Display 0 (Slope to tip Stored)

3. Enter Slope percent to Base.

I. If Positive [B] --> display 0 // slope base entered
II. If Negative [C] --> display 0 // slope base entered

4. [D] ---> Tree Heights

-----------------------------------------------

Example: FIX 1

Slope Percent to tip = 40
Negative slope percent to base = 20
Distance to tree = 56
What is the Tree Heights?

56 [A] display 56
40 [R/S] display 0
20 [C] display 0
[D] 32.9

Tree Heights is 32.9

-------------------------------------------------

Slope Percent to tip = 40
Positive slope percent to base = 20
Distance to tree = 56
What is the Tree Heights?

56 [A] display 56
40 [R/S] display 0
20 [B] display 0
[D] 10.9

Tree Heights is 10.9

Program:
Code:

LBL A   // Enter Distance and Slope Tip
STO 3
R/S
GSB 1
STO 1
CLx
RTN
--------------------------------------------
LBL B  // Enter Positive Slope Base
GSB 1
RCL 1
-
CHS
STO 2
CLx
RTN
------------------------------------------
LBL C  // ENTER Negative Slope Base
GSB 1
RCL 1
+
STO 2
CLx
RTN
-----------------------------------------
LBL D  // Compute Tree Height
RCL 2
SIN
RCL 3
x
90
ENTER
RCL 1
-
SIN
÷
RTN
---------------------------------------
LBL 1
EEX
2
÷
TAN -1
RTN

Gamo
Hand-Held-Calculator Programs for the Field Forester
Wayne D. Shepperd, Associate Silviculturist
General Technical Report RM-76 (July 1980)
Rocky Mountain Forest and Range Experiment Station
Forest Service
U.S. Department of Agriculture
Abstract
A library of programs written for hand-held, programmable
calculators is described which eliminates many of the computations
previously done by hand in the field. Programs for scaling aerial
photos, variable plot cruising, basal area factor gauge calibration,
and volume calculations are included.

Contents
Introduction............................ 1
Slope to Horizontal Distance....... 2
Basal Area Computation............ 3
Tree Heights.......................... 4
Multispecies Board Foot Volumes 7
BAF Gauge Calibration.............. 9
Limiting Distance................... 10
Photo Work Program............... 12
Spruce Variable Plot Cruising.... 14
Literature Cited..................... 17

BEST!
SlideRule
(11-02-2018 01:24 PM)Gamo Wrote: [ -> ]This program was adapted from the Hand-Held-Calculator Programs
for the Field Forester.

More detail information attached here.

Thank you very much. The attached program description seems to refer to a TI program: enter three values with four (!) label keys, finally press another key for the result. But this is HP, the 11C uses RPN, here all this can be done much shorter and more straightforward, even without using a single data register. A direct translationm on the other hand, duplicates the clumsy original procedure:

(11-02-2018 01:24 PM)Gamo Wrote: [ -> ]1. Enter slope distance to base of tree [A] -->Display known distance

2. Enter Slope percent to tip, [R/S] --> Display 0 (Slope to tip Stored)

3. Enter Slope percent to Base.

I. If Positive [B] --> display 0 // slope base entered
II. If Negative [C] --> display 0 // slope base entered

4. [D] ---> Tree Heights

We can do better. ;-)

First of all, mathematically there is no need to distinguish positive or negative base angles and handle them separately. The same formula will work for both cases, as tan(–x) = –tan(x). Also there is no need to calculate sin(90°–B1) as this is equivalent to cos(B1).

Converting the slope values to angles is done in a subroutine. But on the 11C this is merely four steps,*) so two calls require (2x GSB, LBL, 4 steps, RTN) eight lines altogether. This does not save any program steps, compared to having the same four steps twice in the program. So a subroutine has no advantage, and without it the program would even run slightly faster. I left it in there anyway so that the user may do the slope-to-angle conversion with f[E], independently from the rest of the program.

Here is my attempt at realizing all this in a compact 10/11/15C program, but it should run just as well on many other HPs. If your calculator does not feature LBL A or LBL E simply replaced them with numeric ones.

Code:
01 LBL A
02 GSB E
03 X<>Y
04 GSB E
05 COS
06 X<>Y
07 LstX
08 X<>Y
09 -
10 SIN
11 X<>Y
12 ÷
13 x
14 RTN
15 LBL E
16 EEX
17 2
18 ÷
19 TANˉ¹
20 RTN

Enter base distance [ENTER] tip slope percent [ENTER] base slope percent.
Press f[A] to get the tree height.

Enter slope percent, press f[E] and get the equivalent angle.

56  [ENTER]  40  [ENTER] –20 f[A] => 32,95
56  [ENTER]  40  [ENTER]  20  f[A] => 10,98

What is the equivalent angle for a slope of 30% ?
30 f[E] => 16,70°

Edit: here is a version for the HP25(C) which may also run on other calculators without labels and subroutines:

Code:
01 ENTER
02 EEX
03 2
04 ÷
05 TANˉ¹
06 X<>Y
07 EEX
08 2
09 ÷
10 TANˉ¹
11 COS
12 X<>Y
13 LastX
14 X<>Y
15 -
16 SIN
17 X<>Y
18 ÷
19 x
20 GTO 00

Dieter
__________
*) In your original program you could even do it with 3 steps: 1 % TANˉ¹
(11-02-2018 06:15 PM)Dieter Wrote: [ -> ]… attached program description seems to refer to a TI program: enter three values with four (!) label keys, finally press another key for the result …
Dieter
Here's the program
[attachment=6548]
BEST!
SlideRule
(11-02-2018 07:03 PM)SlideRule Wrote: [ -> ]Here's the program

Ah, thank you very much.

But I don't see much of a real program. It's more like a "program outline", as stated in the attachment, a kind of recipe for writing your own program.

BTW the result for the second example, rounded to one decimal, should be 11,0 instead of 10,9.

Dieter
Dieter thanks for the better program update.

This book only show the program guide line to adapted to any programmable
calculator as state at the beginning of the book.

Personally I program this Tree Height as simple to operate as possible so I put
all input operation separately on each labels like so
[A] For Known Distance and Slope Tip
[B] For known Positive Slope Base
[C] For Known Negative Slope Base
[D] Compute Tree Height

------------------------------------------------------
SlideRule Thanks for the program guide line page.

Remark: At second page of this book there are marked for the typo error

On Page 5 Example on the first line:

Should be: Positive Slope Percent to Tip=40

----------------------------------------------------

Gamo
(11-03-2018 01:35 AM)Gamo Wrote: [ -> ]Dieter thanks for the better program update.

See below. ;-)

(11-03-2018 01:35 AM)Gamo Wrote: [ -> ]Personally I program this Tree Height as simple to operate as possible

Does it get simpler than entering the three values on the stack?

(11-03-2018 01:35 AM)Gamo Wrote: [ -> ]so I put all input operation separately on each labels like so
[A] For Known Distance and Slope Tip
[B] For known Positive Slope Base
[C] For Known Negative Slope Base
[D] Compute Tree Height

Again: there is no need for separate calculations for positive or negative slope values. Try it: simply enter –20 at [B]. You may also use two separate labels for the distance and the slope percent to the tip.

Finally here is another version:

In many cases it is a good idea not to follow a given path but to try a new approach instead. This is also the case here. The tree height can also be calculated this way:

b = a·cos(B2) · tan(B1) – a·sin(B2)

The point here is that the sine and cosine term can be simultaneously calculated by means of the P–>R command. And the tangent simply is the tip slope divided by 100.

This leads to the following even shorter program:

Code:
01 LBL A
02 EEX
03 2
04 ÷
05 X<>Y
06 LstX
07 ÷
08 R↓
09 TANˉ¹
10 X<>Y
11 →R
12 R↑
13 x
14 X<>Y
15 -
16 RTN

And here is a version that uses the label keys:

Code:
01 LBL A
02 STO 1
03 RTN
04 LBL B
05 1
06 %
07 TANˉ¹
08 STO 2
09 R↓
10 RTN
11 LBL C
12 1
13 %
14 STO 3
15 R↓
16 RTN
17 LBL D
18 RCL 2
19 RCL 1
20 →R
21 RCL 3
22 x
23 X<>Y
24 -
25 RTN

f[USER]

Enter base distance [A]
Enter base slope percent [B]    (may be positive or negative)
Enter tip slope percent [C]
Calculate tree height with [D]

56 [A] =>  56,00
20 [B] =>  20,00
40 [C] =>  40,00
[D] =>  10,98

-20 [B] => -20,00
[D] =>  32,95

I was playing around a bit with a TI59 emulator, so here also is a version for the TI58/59.

Code:
000 76  LBL
001 11   A
002 42  STO
003 01   01
004 92  RTN
005 76  LBL
006 12   B
007 53   (
008 24  CE
009 55   ÷
010 32  X⇄T
011 01   1
012 00   0
013 00   0
014 54   )
015 22  INV
016 30  TAN
017 42  STO
018 02   02
019 32  X⇄T
020 92  RTN
021 76  LBL
022 13   C
023 42  STO
024 03   03
025 92  RTN
026 76  LBL
027 14   D
028 53   (
029 43  RCL
030 01   01
031 32  X⇄T
032 43  RCL
033 02   02
034 37  P/R
035 94  +/-
036 85   +
037 32  X⇄T
038 65   x
039 43  RCL
040 03   03
041 55   ÷
042 01   1
043 00   0
044 00   0
045 54   )
046 58  FIX
047 02   02
048 52  EE
049 22  INV
050 52  EE
051 92  INV
052 58  FIX
053 92  RTN

Usage is the same as above.
The final steps round the result to two decimals.

Dieter
We don't really need trigonometric functions here.
Good old Pythagoras is good enough:
Code:
01 LBL A
02 x<>y
03 -
04 EEX
05 2
06 LSTx
07 →P
08 x<>y
09 R↓
10 ÷
11 ×
12 RTN

Examples:

56 ENTER
20 ENTER
40 A
10.9825

56 ENTER
-20 ENTER
40 A
32.9475

Cheers
Thomas
(11-04-2018 03:32 PM)Thomas Klemm Wrote: [ -> ]We don't really need trigonometric functions here.
Good old Pythagoras is good enough:

Great! This way it can also be done on the 12C and other calculators without trigs or polar/rectangular conversion:

Code:
01 X<>Y
02 -
03 LstX
04 ENTER
05 x
06 EEX
07 4
08 +
09 √x
10 ÷
11 ×
12 GTO 00

Since no →P is required this may even run slightly faster than Thomas' original version. If available, replace "ENTER x" with x².

(11-04-2018 03:32 PM)Thomas Klemm Wrote: [ -> ]Examples:

56 ENTER
20 ENTER
40 A
10.9825

56 ENTER
-20 ENTER
40 A
32.9475

Same for the above version. Press [R/S] instead of [A]. ;-)

I you, like me, prefer to enter base distance [ENTER] tip slope [ENTER] base slope, simply remove the first line.

Gamo, if you want to implement this for the 11C using the label keys A...D, here is an adapted version:

Code:
01 LBL A
02 STO 1
03 RTN
04 LBL B
05 STO 2
06 RTN
07 LBL C
08 STO 3
09 RTN
10 LBL D
11 RCL 3
12 RCL 2
13 -
14 RCL 2
15 x²
16 EEX
17 4
18 +
19 √x
20 ÷
21 RCL 1
22 x
23 RTN

This thread shows once again how a new approach and a bit of better mathematical insight can substantially improve a given solution. So don't adapt programs or algorithms, rethink the problem and realize your own solution. Or "dare to think for yourself", as others have put it.

Dieter
Thanks Thomas Klemm and Dieter

Programs updates is more streamline now even work on HP-12C

Excellent Idea !!

Gamo
(11-04-2018 04:57 PM)Dieter Wrote: [ -> ]
(11-04-2018 03:32 PM)Thomas Klemm Wrote: [ -> ]We don't really need trigonometric functions here.
Good old Pythagoras is good enough:

Great! This way it can also be done on the 12C and other calculators without trigs or polar/rectangular conversion:

Code:
01 X<>Y
02 -
03 LstX
04 ENTER
05 x
06 EEX
07 4
08 +
09 √x
10 ÷
11 ×
12 GTO 00

Since no →P is required this may even run slightly faster than Thomas' original version. If available, replace "ENTER x" with x².

(11-04-2018 03:32 PM)Thomas Klemm Wrote: [ -> ]Examples:

56 ENTER
20 ENTER
40 A
10.9825

56 ENTER
-20 ENTER
40 A
32.9475

Same for the above version. Press [R/S] instead of [A]. ;-)

That's a neat solution! It's also worth mentioning that if you know the tangent, sine or cosine of an angle between 0 and 90 degrees, you can derive the others with standard arithmetic and the square root function.

$$\tan(x) = \frac{\sqrt{1-\cos^2(x)}}{\cos(x)}$$, or: $$\tan(x) = \sqrt{\frac{1}{\cos^2(x)} - 1}$$

Code:
ENTER
×
1/x
1
-
√x

$$\cos(x) = \frac{1}{\sqrt{1 + \tan^2(x)}}$$

Code:
ENTER
×
1
+
√x
1/x

$$\tan(x) = \frac{\sin(x)}{\sqrt{1 - \sin^2(x)}}$$

Code:
ENTER
ENTER
×
1
X<>Y
-
√x
÷

$$\sin(x) = \frac{\tan(x)}{\sqrt{1 + \tan^2(x)}}$$

Code:
ENTER
ENTER
×
1
+
√x
÷

$$\sin(x) = \sqrt{1 - \cos^2(x)}$$, and: $$\cos(x) = \sqrt{1 - \sin^2(x)}$$

Code:
ENTER
×
1
X<>Y
-
√x

Of course, "ENTER", "×" can be replaced by "x²" in all of the above, if available.
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :