Boole[expr] is a basic function that turns
True and
False into
1 and
0. It is sometimes known as the
characteristic function or
indicator function.
It is often convenient to have functions with different forms in different regions. You can do this using
Piecewise.
Piecewise functions appear in systems where there is discrete switching between different domains. They are also at the core of many computational methods, including splines and finite elements. Special cases include such functions as
Abs,
UnitStep,
Clip,
Sign,
Floor and
Max.
Mathematica handles piecewise functions in both symbolic and numerical situations.