HP 9g hp 9g_user's manual_English_E_HDP1SG18ES1.pdf - Page 30

Debugging a Program, Using the Graph Function in Programs, Display Result Command, Deleting

Page 30 highlights

Debugging a Program A program might generate an error message or unexpected results when it is executed. This indicates that there is an error in the program that needs to be corrected. • Error messages appear for approximately 5 seconds, and then the cursor blinks at the location of the error. • To correct an error, select EDIT from the program menu. • You also can select TRACE from the program menu. The program is then checked step-by-step and a message alerts you to any errors. Using the Graph Function in Programs Using the graph function within programs enables you to graphically illustrate long or complex equations and to overwrite graphs repeatedly. All graph commands (except trace and zoom) can be included in programs. Range values can also be specified in the program. Note that values in some graph commands must be separated by commas , ( ) as follows: • Range ( Xmin, Xmax, Xscl, Ymin, Ymax, Yscl ) • Factor ( Xfact, Yfact ) • Plot ( X point, Y point ) Display Result Command You can put in a program if you want to be able to see the value of a variable at that particular stage in program execution. For example: Line 1: INPUT A ; B = ln ( A + 100 ) Line 2: C = 13 × A ; -------Stop at this point Line 3: D = 51 / ( A × B ) Line 4:PRINT " D = ", D ; END 1. Execution is interrupted at the point where you placed . 2. At this time, you can press [ 2nd ] [ RCL ] to view the value of the corresponding memory variable (C in the above example). 3. To resume program execution, press [ ]. Deleting a Program 1. Select DEL from the program menu and press [ ]. 2. To erase a single program, select ONE, the program area you want to erase, and then press [ ] E-30

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87

E-30
Debugging a Program
A program might generate an error message or unexpected results when it
is executed. This indicates that there is an error in the program that needs to
be corrected.
Error messages appear for approximately 5 seconds, and then the
cursor blinks at the location of the error.
To correct an error, select
EDIT
from the program menu.
You also can select
TRACE
from the program menu. The program is
then checked step-by-step and a message alerts you to any errors.
Using the Graph Function in Programs
Using the graph function within programs enables you to graphically
illustrate long or complex equations and to overwrite graphs repeatedly. All
graph commands (except trace and zoom) can be included in programs.
Range values can also be specified in the program.
Note that values in some graph commands must be separated by commas
(
) as follows:
Range
( Xmin, Xmax, Xscl, Ymin, Ymax, Yscl )
Factor
( Xfact, Yfact )
Plot
( X point, Y point )
Display Result Command
You can put
in a program if you want to be able to see the value of a
variable at that particular stage in program execution.
For example:
Line 1:
INPUT
A ; B = ln ( A + 100 )
Line 2:
C = 13
×
A ;
-------Stop at this point
Line 3:
D = 51 / ( A
×
B )
Line 4:
PRINT
” D = ”, D ; END
1.
Execution is interrupted at the point where you placed
.
2.
At this time, you can press [ 2nd ] [ RCL ] to view the value of the
corresponding memory variable (
C
in the above example).
3.
To resume program execution, press [
].
Deleting a Program
1. Select
DEL
from the program menu and press [
].
2.
To erase a single program, select
ONE
, the program area you want to
erase, and then press [
]