Page 21-22
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:35
in stack level 1.
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:
«
“
Enter a:
“
{
“
:a:
“
{2 0} V }
INPUT OBJ
→ →
a
«
‘
2*a^2+3
‘
» »
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
2
+3
,
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
`
Copies program name to stack level 1
„°LL
@)@RUN@ @@DBG@
Starts debugger
@SST
↓
@
Step-by-step debugging, result: “Enter a:”
@SST
↓
@
Result: {“
a:” {2 0} V}
@SST
↓
@
Result: user is prompted to enter value of a
2`
Enter a value of 2 for a. Result: “
:a:2”
@SST
↓
@
Result: a:2
Содержание 50G
Страница 1: ...HP g graphing calculator user s guide H Edition 1 HP part number F2229AA 90006 ...
Страница 130: ...Page 2 70 The CMDS CoMmanDS menu activated within the Equation Writer i e O L CMDS ...
Страница 177: ...Page 4 10 Function DROITE is found in the command catalog N Using EVAL ANS 1 simplifies the result to ...
Страница 206: ...Page 5 29 LIN LNCOLLECT POWEREXPAND SIMPLIFY ...
Страница 257: ...Page 7 20 ...
Страница 383: ...Page 11 56 Function KER Function MKISOM ...
Страница 715: ...Page 21 68 Whereas using RPL there is no problem when loading this program in algebraic mode ...
Страница 858: ...Page L 5 ...