beautypg.com

User-defined functions, Creating a user-defined function, User-defined fimctions -4 – HP 49g Graphing Calculator User Manual

Page 148: Using a variable in a calculation

Attention! The text in this document has been recognized automatically. To view the original document, you can use the "Original mode".

background image

Using a variable in a calculation

You can use a variable’s contents in a calculation. To continue the

example on page 7-2, suppose you have stored the acceleration of gravity
in a variable named GRAY and that tlris variable happens to be
represented by (F3)- To multiply the acceleration of gravity by 7, you would

press;

i3) places the variable’s name on the command line. Pressing

causes the variable, and then the entire expression, to be evaluated.

Note that if the variable you want to use is not available when you press

(WR), you must first select the directory in which the variable is stored.

(See “Selecting a directory or variable” on page 7-7.)

User-defined functions

User-defined fimctions are a special type of variable. Like variables, you
give a user-defined fimction a name, and store it for later use.

User-defined fimctions operate in the same way as nonnal functions: that
is, you enter the function name, specify the argument or arguments in

parentheses, and then press (ENTER) or 0(33) to evaluate the fimction. The

difference is that you create the function yourself, and give it a name of

your choosing.

Creating a user-defined Function

The following example illustrates how to create a user-defined function to

evaluate 3co.s(.i”) and store it with the name “F2(0”:

1. Press 0rPEF) to place the DEFINE command on tlie command line.

2. With the cursor between the command’s parentheses, define the

function.

®i)F20©@®003(COS)@(2)2

Note that the name you want to give your function must appear to the
left of the equals sign. You specify the fimction to the right of the

equals sign.

3. Press (BNTER) to define the fimction and store it in the current directory.

In this example, it is stored as “F2”.

Page 7-4

Storing objects