
Page 21-50
While this simple construct works fine when your function has only two
branches, you may need to nest IF…THEN…ELSE…END constructs to deal
with function with three or more branches. For example, consider the
function
−
<
≤
<
≤
<
≤
−
<
=
elsewhere
x
if
x
x
if
x
x
if
x
x
if
x
x
f
,
2
15
3
),
exp(
3
5
),
sin(
5
3
,
1
3
,
)
(
2
3
π
π
Here is a possible way to evaluate this function using IF… THEN … ELSE …
END constructs:
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
A complex IF construct like this is called a set of
nested
IF … THEN … ELSE …
END constructs.
A possible way to evaluate f3(x), based on the nested IF construct shown
above, is to write the program:
Содержание 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 ...