Boole

Boole[expr]

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

Details

  • Boole is also known as Iverson bracket, indicator function and characteristic function.
  • Boole is typically used to express integrals and sums over regions given by logical combinations of predicates. It is also used as a dummy variable encoding for categorical variables in statistics.
  • 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)

Convert a list of truth values to integers:

Find the area of the disc defined by the inequality :

Applications  (4)

Find the area of a region defined by an inequality:

Plot the region:

Find the volume of a solid defined by an inequality:

Plot the solid:

Find the area of the intersection of a circle with a parametric radius and a square:

Convert a table of True,False values to 1,0 for plotting:

Properties & Relations  (7)

The inverse of Boole:

Use PiecewiseExpand to convert Boole to Piecewise:

Correspondence between logic operations on conditions and arithmetic operations on Boole:

Use Refine, Simplify, and FullSimplify to transform expressions involving Boole:

Reduce equations and optimize functions involving Boole:

Use Boole as a characteristic function for integration problems:

Boole can be represented as a DifferenceRoot in certain cases:

Wolfram Research (2004), Boole, Wolfram Language function, https://reference.wolfram.com/language/ref/Boole.html (updated 2007).

Text

Wolfram Research (2004), Boole, Wolfram Language function, https://reference.wolfram.com/language/ref/Boole.html (updated 2007).

CMS

Wolfram Language. 2004. "Boole." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/Boole.html.

APA

Wolfram Language. (2004). Boole. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Boole.html

BibTeX

@misc{reference.wolfram_2024_boole, author="Wolfram Research", title="{Boole}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Boole.html}", note=[Accessed: 22-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_boole, organization={Wolfram Research}, title={Boole}, year={2007}, url={https://reference.wolfram.com/language/ref/Boole.html}, note=[Accessed: 22-December-2024 ]}