
Page 21-54
„°
@)@BRCH@ @)START @START
Within the BRCH menu (
„°
@)@BRCH@
) the following keystrokes are available
to generate START constructs (the symbol indicates cursor position):
•
„
@START
: Starts the START…NEXT construct: START
NEXT
•
‚
@START
: Starts the START…STEP construct: START
STEP
The START…NEXT construct
The general form of this statement is:
start_value end_value START program_statements NEXT
Because for this case the increment is 1, in order for the loop to end you
should ensure that
start_value < end_value
. Otherwise you will
produce what is called an infinite (never-ending) loop.
Example – calculating of the summation S defined above
The START…NEXT construct contains an index whose value is inaccessible to
the user. Since for the calculation of the sum the index itself (k, in this case) is
needed, we must create our own index, k, that we will increment within the
loop each time the loop is executed. A possible implementation for the
calculation of S is the program:
«
0. DUP
→
n S k
«
0. n START k SQ S + 1.
‘
k
‘
STO+
‘
S
‘
STO
NEXT S
“
S
”
→
TAG
»
»
Type the program in, and save it in a variable called
@@@S1@@@
.
Here is a brief explanation of how the program works:
1. This program needs an integer number as input. Thus, before execution,
that number (n) is in stack level 1. The program is then executed.
Содержание 49g+
Страница 1: ...hp 49g graphing calculator user s guide H Edition 4 HP part number F2228 90006 ...
Страница 197: ...Page 5 30 LIN LNCOLLECT POWEREXPAND SIMPLIFY ...
Страница 377: ...Page 11 55 Function KER Function MKISOM ...
Страница 457: ...Page 13 26 In the right hand side figure above we are using the line editor to see the series expansion in detail ...
Страница 775: ...Page 26 10 the location of the backup battery in the top compartment at the back of the calculator ...
Страница 838: ...Page L 5 ...