The Ifte Function; Combined Ifte Functions - HP F2226A - 48GII Graphic Calculator User Manual

Graphing calculator.

The calculator provides the function IFTE (IF-Then-Else) to describe such
functions.

The IFTE function

The IFTE function is written as
If condition is true then operation_if_true is performed, else operation_if_false
is performed. For example, we can write 'f(x) = IFTE(x>0, x^2-1, 2*x-1)', to
describe the function listed above.
function catalog (‚N). The symbol '>' (greater than) is available as
(associated with the Y key). To define this function in ALG mode use the
command:
DEF(f(x) = IFTE(x>0, x^2-1, 2*x-1))
then, press `.
In RPN mode, type the function definition between
apostrophes:
then press „à.
Press J to recover your variable menu.
available in your soft key menu. Press ‚@@@f@@@ to see the resulting program:
<<
To evaluate the function in ALG mode, type the function name, f, followed by
the number at which you want to evaluate the function, e.g., f(2), then press
`. In RPN mode, enter a number and press @@@f@@@.
that f(2) = 3, while f(-2) = -5.

Combined IFTE functions

To program a more complicated function such as
you can combine several levels of the IFTE function, i.e.,
'g(x) = IFTE(x<-2, -x, IFTE(x<0, x+1, IFTE(x<2, x-1, x^2)))'
IFTE(condition, operation_if_true, operation_if_false)
Function IFTE is accessible from the
'f(x) = IFTE(x>0, x^2-1, 2*x-1)'
x 'IFTE(x>0, x^2-1, 2*x-1)' >>
x
,
x
x
, 1
2
g
(
x
)
x
, 1
0
2
x
,
x
The function @@@f@@@ should be
Check, for example,
2
x
0
x
2
2
,
Page 3-36  