A Function With An Input String - HP 50g User Manual

Graphing calculator
Hide thumbs Also See for 50g:
Table of Contents

Advertisement

The result is a stack prompting the user for the value of a and placing the cursor
right in front of the prompt :a: Enter a value for a, say 35, then press `.
The result is the input string

A function with an input string

If you were to use this piece of code to calculate the function, f(a) = 2*a^2+3,
you could modify the program to read as follows:
Save this new program under the name 'FUNCa' (FUNCtion of a):
Run the program by pressing @FUNCa. When prompted to enter the value of a
enter, for example, 2, and press `. The result is simply the algebraic 2a
which is an incorrect result. The calculator provides functions for debugging
programs to identify logical errors during program execution as shown below.
Debugging the program
To figure out why it did not work we use the DBUG function in the calculator as
follows:
³@FUNCa `
„°LL @) @ RUN@ @@DBG@
@SST @
@SST @
@SST @
2`
@SST @
in stack level 1.
:a:35
"Enter a: " {" :a: " {2 0} V }
«
INPUT OBJ
Copies program name to stack level 1
Starts debugger
Step-by-step debugging, result: "Enter a:"
Result: {"
Result: user is prompted to enter value of a
Enter a value of 2 for a. Result: " :a:2"
Result: a:2
'2*a^2+3'
«
a
a:" {2 0} V}
» »
Page 21-22
2
+3,

Advertisement

Table of Contents
loading

Table of Contents