HP Calculatrice graphique HP 49g Manuel d'utilisation
Page 771
Advertising

Page 21-55
−
<
≤
<
≤
<
≤
−
<
=
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
π
π
Voici un moyen possible d’évaluer cette fonction à l’aide de constructions IF…
THEN … ELSE … END :
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
Une construction IF complexe de ce type est appelée série de constructions
IF … THEN … ELSE … END imbriquées.
Une solution possible pour évaluer f3(x), en fonction de la construction IF
imbriquée présentée ci-dessus, consiste à rédiger le programme suivant :
«
→ 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
» »
Advertising