beautypg.com

Algebraic and rpn modes, Using functions that require arguments, Algebraic and rpn modes -21 – HP 49g Graphing Calculator User Manual

Page 191: Using functions that require arguments -5, Enter a number" input obj, Input ("enter a number"," obj^ (numi) ^ numi, Numi

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

background image

Algebraic and RPN modes

In RPN mode, the HP 49G makes extensive use of the stack. Wlien

developing programs in RPN mode, you use the stack to:

® provide the data that your program uses

e construct the commands that your program uses

® hold the output that your program generates.

In algebraic mode, the stack is not available. You use other methods to

build your program and to pass data to it.

Using Functions that require arguments

When using a function that requires arguments:

® In RPN mode, you place the arguments on the stack before calling the

fimction.

® In algebraic mode, you supply the arguments, enclosed in parentheses,

after the function call.

For example, you can use the INPUT command to prompt for data. The

following code segments demonstrate how to use the INPUT command to

collect data in both RPN and algebraic modes.

® In RPN mode, the following code segment prompts for input, collects

the data as a string and converts it to a nmnber. At the end of the
process, the data is on level 1 of the stack:

« "ENTER A NUMBER"

INPUT

OBJ —> »

® In Algebraic mode, the following code segment performs the same

operation. At the end of this process, the data is stored in a global

variable, NUMl, ready for use in the program.

Note that, since you are using a global rather than a local variable, you

can follow the variable declaration with a function.

« INPUT ("ENTER A NUMBER","
OBJ^ (NUMI) ^ NUMI »

¥

NUMI;

Introduction to programming

Page 10-5