DiscreteIndicator[x,x1,{u1,u2,…}]
yields the discrete indicator function, equal to 1 if x=x1 and, otherwise, to 0 if x=ui for some i.
DiscreteIndicator
DiscreteIndicator[x,x1,{u1,u2,…}]
yields the discrete indicator function, equal to 1 if x=x1 and, otherwise, to 0 if x=ui for some i.
Details
- DiscreteIndicator[x,x1,{u1,u2,…}] remains unevaluated if x or x1 is not any of the ui. »
Examples
open all close allBasic Examples (1)
Applications (1)
Represent nominal terms in fitting results:
lm = LinearModelFit[{{a, 1.5}, {b, 2.3}, {b, 1.8}, {a, 2.5}}, x, x, NominalVariables -> x]Normal[lm]Evaluate the FittedModel at points a and b:
{lm[a], lm[b]}Properties & Relations (2)
DiscreteIndicator is equivalent to Boole when both values are in the set:
Table[{DiscreteIndicator[x, a, {a, b, c}], Boole[x === a]}, {x, {a, b, c}}]They differ if either of the first two values is not in the set:
{DiscreteIndicator[x, a, {a, b, c}], Boole[x === a]}Products of indicator functions effectively correspond to an outer product:
Flatten[Table[{{x, y},
DiscreteIndicator[x, a, {a, b}]DiscreteIndicator[y, b, {a, b}], DiscreteIndicator[{x, y}, {a, b}, {{a, a}, {a, b}, {b, a}, {b, b}}]}, {x, {a, b}}, {y, {a, b}}], 1] //GridSee Also
Related Guides
History
Text
Wolfram Research (2008), DiscreteIndicator, Wolfram Language function, https://reference.wolfram.com/language/ref/DiscreteIndicator.html.
CMS
Wolfram Language. 2008. "DiscreteIndicator." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DiscreteIndicator.html.
APA
Wolfram Language. (2008). DiscreteIndicator. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DiscreteIndicator.html
BibTeX
@misc{reference.wolfram_2026_discreteindicator, author="Wolfram Research", title="{DiscreteIndicator}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/DiscreteIndicator.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_discreteindicator, organization={Wolfram Research}, title={DiscreteIndicator}, year={2008}, url={https://reference.wolfram.com/language/ref/DiscreteIndicator.html}, note=[Accessed: 13-June-2026]}