Problems - HP -67 Owner's Handbook Manual

Hide thumbs Also See for HP-67:
Table of Contents

Advertisement

208
Subroutines
Problems
1.
Look closely at the program for finding roots r; and r,
of a quadratic equation (page 200). Can you see other instruc-
tions that could be replaced by a subroutine? (Hint: look at steps
013 through 016 and steps 021 through 024.) Modify the pro-
gram by using another subroutine and run it to find the roots of
x2+x—-—6=0;0f3x2 +2x — 1 =0.
(Answers: 2, —3; 0.33, —1)
How many more steps of program memory did you save?
The surface area of a sphere can be calculated according to the
equation A = 4mr?, where r is the radius. The formula for
3
finding the volume of a sphere is V = dmm
. This may also be
r X4
expressed as V =
3
Create and load a program to calculate the area A of a sphere
given its radius r. Define the program with
{9 and
and
include an initialization routine to store the value of the radius.
Then create and load a second program to calculate the volume
r XA
V of a sphere, using the equationV =
. Define this sec-
ond program with
[zl and (RTN], and include the instruction
(1) to use a portion of program [ as a subroutine
calculating area.
Run the two programs to find the area and volume of the
planet earth, a sphere with a radius of about 3963 miles. Ofthe
earth's moon, a sphere with a radius of about 1080 miles.
Answers: Earth area = 197359487.5 square miles
Earth volume = 2.6071188 X 10! cubic miles
Moon area = 14657414.69 square miles
Moon volume = 5276669290 cubic miles

Advertisement

Table of Contents
loading

Table of Contents