Radio Shack TRS-80 User Manual page 163

Micro computer system
Hide thumbs Also See for TRS-80:
Table of Contents

Advertisement

repeat the process
until
you
find
the
right tree ...
or surrender to
frostbite.
Or you
can
use
a
little
trigonometry.
Trigonometry
will let
you
figure
the
height,
H, of
the
tree
from two
simple
facts:
your
distance,
D,
from
the base of the
tree,
and
the
angle,
A,
between
the base
and
tip
of the
tree
as
measured from
the point
at
which
you're standing:
If
you're standing
as
indicated
in
the drawing,
then
H
=
D*TAN(A)
(That's
"H
equals
D
times the tangent of angle A.")
Here's
where
the
TRS-80
comes
in.
(You'll
also
need
a
very long extension
cord
to
run
from
the nearest
electrical
outlet to
the
site
of the
tree.)
TAN(X)
is
one
of the trigonometric functions
available
as
a
subroutine
for
the
TRS-80.
Turn
to
page
218
of
Appendix
A
and
find
the
Tangent
Subroutine.
(It's
the longest of the
"trig"
subroutines,
because
it
actually contains
two
of the
others,
Sine
and
Cosine).
Type
NEW
to clear
out
the
program
memory
and
carefully
type
in
the
tangent subroutine
(steps
30300
to
30455).
Be
sure
to
add
a protective
END
block:
30000 END
Now
type
in
the following
program:
1
tar
IN.
"HOW
FAR ARE YOU FROM BASE OF
TREE";D
20 IN.
"WHAT
IS
ANGLE BETWEEN TIP AND BASE OF
TREE";A
30
X=A:GOSUB 30320
40
H=INT( D*Y+
.5
)
50 IF
H=28 THEN
80
60
P.
"FIND ANOTHER
TREE
THIS ONE IS"sH;
"FEETTALL."
?A
,!»,
161

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents