Page 21-51
«
→
x
«
IF
‘
x<3
‘
THEN
‘
x^2
‘
ELSE IF
‘
x<5
‘
THEN
‘
1-x
‘
ELSE IF
‘
x<3*
π
‘
THEN
‘
SIN(x)
‘
ELSE IF
‘
x<15
‘
THEN
‘
EXP(x)
‘
ELSE –2
END END END END EVAL
»
»
Store the program in variable
@@@f3@@@
and try the following evaluations:
1.5
@@f3@@@
Result
: 2.25 (i.e., x
2
)
2.5
@@@f3@@@
Result
: 6.25 (i.e., x
2
)
4.2
@@@f3@@@
Result
: -3.2 (i.e., 1-x)
5.6
@@@f3@@@
Result
: -0.631266… (i.e., sin(x), with x in radians)
12
@@@f3@@@
Result
: 162754.791419 (i.e., exp(x))
23
@@@f3@@@
Result
: -2. (i.e., -2)
The CASE construct
The CASE construct can be used to code several possible program flux paths,
as in the case of the nested IF constructs presented earlier. The general
format of this construct is as follows:
CASE
Logical_statement
1
THEN program_statements
1
END
Logical_statement
2
THEN program_statements
2
END
.
.
.
Logical_statement THEN program_statements
END
Default_program_statements (optional)
END
When evaluating this construct, the program tests each of the
logical_statements
until it finds one that is true. The program executes the
corresponding
program_statements
, and passes program flow to the statement
following the END statement.
The CASE, THEN, and END statements are available for selective typing by
using
„°
@)@BRCH@ @)CASE@
.
Содержание 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 ...