Boole

Boole[expr]

yields 1 if expr is True and 0 if it is False.

Details

  • Boole[expr] remains unchanged if expr is neither True nor False.
  • Boole[expr] is effectively equivalent to If[expr,1,0].
  • Boole is Listable.
  • Integrate[f Boole[pred],] can be used to integrate f over the region in which pred is True.

Examples

open allclose all

Basic Examples  (3)

In[1]:=
Click for copyable input
Out[1]=

Convert a list of truth values to integers:

In[1]:=
Click for copyable input
Out[1]=

Find the area of the disc defined by the inequality :

In[1]:=
Click for copyable input
Out[1]=

Applications  (4)

Properties & Relations  (7)

See Also

If  Piecewise  DiscreteDelta  UnitStep  Unitize  DiscreteIndicator  Pick  RegionPlot  True

Tutorials

Introduced in 2004
(5.1)
| Updated in 2007
(6.0)