# HP 48gII Advanced User's Reference Manual Page 31

Graphing calculator.

Example:
Enter a program SPH that calculates the volume of a spherical cap of height h within a sphere of
radius R using values stored in variables H and R.
In this and following chapters on programming, "stack diagrams" show what arguments must be on the stack
before a program is executed and what results the program leaves on the stack. Here's the stack diagram for
SPH.
The diagram indicates that SPH takes no arguments from the stack and returns the volume of the spherical cap
to level 1. (SPH assumes that you've stored the numerical value for the radius in variable R and the numerical
value for the height in variable H. These are global variables — they exist outside the program.)
Program listings are shown with program steps in the left column and associated comments in the right column.
Remember, you can either press the command keys or type in the command names to key in the program. In this
first listing, the keystrokes are also shown.
«
'1/3
*œ*H^2
*(3*R-H)'
NUM
"
Level 1
Program:
Keys:
@%
O1 /3
*!ì
*H Q2
*!Ü
3 * R -
H ™™
`
OSPH K
1
2
V
=
-- - h
3r h
3
"
Level 1
"
volume
Begins the program.
Begins the algebraic expression
to calculate the volume.
Multiplies by h
.
2
Multiplies by 3r - h, completing
the calculation and ending the
expression.
Converts the expression with
a number.
Ends the program.
Puts the program on the stack.
Stores the program in variable
SPH.
to
RPL Programming 1-5

49g+