# User manual | hp calculators

```hp calculators
HP 9g Graphing Functions – Part 1
Built-in Function Graphs
Overlaying Graphs
hp calculators
HP 9g Graphing Functions – Part 1
Built-in function graphs
The HP 9g is a graphing calculator. Even though its resolution (35 x 23 pixels) is not as large as calculators such as the
HP49g+, it will help you solve a wide variety of problems, as we’ll try to illustrate with various examples.
For a start, turn your HP 9g on and press P, H and =. Figure 1 shows what
appears in the display.1 A graph of the sine function. You did not have to enter any
arguments, specify the display range or scale, nor set the angle unit. Three keystrokes is
all it takes to plot this function with an optimum range. With such a limited resolution,
choosing the perfect settings is not always easy. That’s why the HP 9g provides the builtin function graphs. The HP 9g can plot up to twenty-one functions automatically:
Figure 1
♦ All the trigonometric and hyperbolic functions, including their inverse functions (namely, H, I, J,
~mH, ~mI, ~mJ, ~h, ~i, ~j, ~m~h,
~m~i and ~m~j)
♦ Logarithms (G and F) and antilogarithms (~f and ~g)
♦ Roots (K and ~×)
♦ Powers (L, ~Ù and ~l)
Example 1: Plot the function y = 3 x .
Solution:
Since this is one of the twenty-one functions the HP 9g can plot
automatically, let your HP 9g do all the work for you. Press
P~Ù=. Notice that the previous graph disappeared. When
displaying a built-in graph, the graphic display is always cleared first. You
can clear the graphic display at any time by pressing the ~T key.
Superimposing graphs is possible, though—read on!
Figure 2
Figure 2 shows the resulting graph.
Example 2: Plot the function y =
been used?
x using the built-in settings. What ranges have
Solution:
Press PK=. The positive branch of the square root function is
Figure 3
displayed (figure 3). In order to find the display range used, press the C
key. It displays the following six values: Xmin (minimum horizontal value), Xmax (maximum horizontal
value), Xscl (horizontal tick spacing), Ymin (minimum vertical value), Xmax (maximum vertical value), Xscl
(vertical tick spacing). These values are displayed one at a time, press … or ‡ to display the previous or
the next value, respectively. Pressing = also displays the next value.
The range of this graph is [–1, 8.5] for the X-axis and [–1.25, 3.25] for the Y-axis.
1
Although figures in this document are not an exact replica of the actual HP 9g graph display, we hope they will help you follow the examples.
hp calculators
-2-
HP 9g Graphing Functions – Part 1- Version 1.0
hp calculators
HP 9g Graphing Functions – Part 1
Example 3: Graph the function y = x 3 using the following ranges and scales: Xmin= 0, Xmax = 2, Xscl = 1, Ymin = 0,
Ymax = 10, Yscl= 5
Solution:
First of all press B. This key switches between the graph display and the text display. Now press C
and enter the new settings by pressing:
0=2=1=0=10=5=
Let’s now graph the function. Press: PW1~Ù=.
There are several things to notice in this example. First, even though the HP 9g has a built-in graph for this
function, we cannot plot a built-in graph this time, because we are not using the same settings as the builtin ones. That’s why we have specified the variable X (we can’t choose another one, the independent
variable is always X on the HP 9g). Also, we did not have to clear the
graph display beforehand, because the new settings already involves
clearing the display. Finally, notice that the settings must be specified
before graphing.
Figure 4
Figure 4 shows the resulting graph.
Overlaying graphs
Example 4: Superimpose the graph of y = e x over the previous graph.
Solution:
Press: PgW1=. As simple as that. We’re using the same
range as before. Notice that we have to include the variable X, because
the HP 9g would plot a built-in graph otherwise, clearing the previous one.
Figure 5 shows the resulting display.
Figure 5
Example 5: Graphically, verify that tanh( x ) < x < sinh( x ) < cosh( x ) for x > 0.
Solution:
Since cosh returns the greatest values, we’ll plot this function first. And we’ll let our calculator select the
optimum settings. Press:
P~mI=
The graph displayed is shown in fig 6. But., we are interested only in
positive values of x… Simply, let’s scroll the graph, which can be done
using the cursor keys: …,‡ , „ and † provided a graph is being
displayed. Press † twice. The graph is now the one shown in Fig 7.
Figure 6
The next step is to overdraw the graphs of y = tanh( x ), y = x and y = sinh(
x ). No new settings have to be specified, but we cannot use built-in
hp calculators
-3-
Figure 7
HP 9g Graphing Functions – Part 1- Version 1.0
hp calculators
HP 9g Graphing Functions – Part 1
graphs because they would clear the previous ones. Therefore we must include the argument when plotting
these functions. Press:
P~mHW1=
PW1=
P~mJW1=
Figure 8 shows the resulting display, and that the hyperbolic function
inequalities hold for the displayed values of x. The inequalities are
revealed even more clearly in the actual HP 9g graph display.
Figure 8
Example 6: The psychologist Ebbinghaus has found a remarkable function which models the amount of material that a
student can recall x weeks after having learned it. The function returns a percentage and is of the form:
f ( x ) = (100 − a)e −kx + a
where k and a are constants: k > 0 and 0 < a < 100. Plot f(x) for a=15 and k = 0.5. Use the following range
and scale: Xmin = –1, Xmax = 15, Xscl = 1, Ymin = –1, Ymax = 30, and Yscl =10.
Solution:
First of all, clear the graph display by pressing ~T. We now have to set the given range and scale.
Press:
:CM1=15=1=M1=30=10=
Let’s now store 15 and 0.5 in the variables A and K, respectively:
15AA=
.5AK=
Figure 9
To plot the psychophysics function, press:
PN100-WA†~gMWKW1†+WA=
Figure 9 shows the resulting graph. During the first weeks, a large amount of material is retained by the
student, but this amount decreases rapidly in a short period of time, after which a smaller percentage is
remembered for a long time.
Example 7: Using the default ranges and scales, plot the following piece-wise defined function:
⎧⎪( x + 2) 2 , for x < −2
f ( x) = ⎨
⎪⎩− 2 − x, for x ≥ −2
Solution:
hp calculators
Once again, press ~T to clear the graph display. The default values are set by pressing : when
displaying the range values:
-4-
HP 9g Graphing Functions – Part 1- Version 1.0
hp calculators
HP 9g Graphing Functions – Part 1
:C:C
The ranges and scales are now set to: Xmin = –3.4, Xmax = 3.4, Xscl = 1, Ymin = –2.2, Ymax = 2.2, and
Yscl =1.
Piece-wise defined functions can de entered using the relational operators (i.e. <, >, ≥, etc). Consider this
function:
f ( x ) = ( x + 2) 2 ( x < −2) + ( −2 − x )( x ≥ −2)
Note that when x < –2, the term (x < –2) will be equal to 1 (i.e. true) and (x ≥ –2) will be 0 (i.e. false).
Likewise for x ≥ –2. Therefore, this function is equivalent to the former. Trouble is that the relational
operators cannot be entered into the entry line in the Main mode.
We have to write a small program to plot this function:
Line No.
Command
Line 1
Graph Y = (X+2)2(X< -2) + (-2–X)(X≥-2)
Line 2
END
Keys
PNW1+2†LNW1~
ÊM2†+NM2W1†NW1~ÌM2†=
Inserted automatically
Once the program has finished, press B to display the plot without the blinking cursor. Also, remember
that running programs can be interrupted by pressing :. (Please refer to the learning module Writing a
Figure 10 shows the graph generated by the program. Notice that f(x)
does not have a discontinuity at x = –2.
Figure 10
Example 8: Investigate the behavior of the graph y = sin( x + a) as the value of a
changes.
Solution:
This can be done by superimposing several plots of the graph for different values of a, and we’ll write a
small program to do it. Since the program will run in degree mode (we could have chosen another angle
unit, though) the range settings will be expressed in degrees, which will be the same as the optimum
settings generated by the HP 9g when plotting the built-in graph: sin(). Make sure the angle unit is set to
DEG, and press:
PH=C and ‡ as needed,
to display the range and scale values, which are: Xmin = –360, Xmax = 360, Xscl = 180, Ymin = –1.25,
Ymax = 1.25, and Yscl = 0.5
Here’s the program listing:
hp calculators
-5-
HP 9g Graphing Functions – Part 1- Version 1.0
hp calculators
HP 9g Graphing Functions – Part 1
Line
Line 1
Command
A=0
Line 2
RANGE(-360, 360, 180, -1.25, 1.25, 0.5)
Line 3
Line 4
Line 5
Lbl 0:
Graph Y=sin(X+A)
A=A+60
Line 6
IF(A ≤120) THEN { GOTO 0 }
Line 7
END
Keys
WAW=0=
CM360W0360W0
180W0M1.25W0
1.25W0.5†=
~v~v10†=
PHW1+WA†=
WAW=WA+60
~v=WI~Í120††~
v~v=0
Inserted automatically
Notice that a Lbl/GOTO loop is used instead of a FOR loop. This is due to a bug in the calculator that
prevents “Graph Y=” instructions from being included in a FOR loop (editing the program once it has been
run will hang the calculator: you’ll have to press ,+ `, which wipes out the entire memory). Since
GOTO nesting is limited to three levels, we can plot only three graphs in a loop, which are for a = 0º, 60º
and 120º . (More graphs can be plotted by adding more loops to the program).
Remember to press B once the program has finished.