# Is there a generally accepted name for the function $f = \{0 \text{ when } x=0, 1 \text{ when } x ≠0 \}$?

In one of my computer programming projects I have defined the following quite common function:

$$f(x) = \begin{cases} 0, & \text{ when } x = 0, \\ 1, & \text{ when } x \neq 0. \end{cases}$$

From what I understand, this is essentially an indicator function, more specifically $1_{x \neq 0}$. Unfortunately, most programming languages are quite restrictive in what one can use as an indentifier and mathematical symbols do not generally make the cut.

So, is there a standard name for this function? Something familiar to English-speaking$^1$ scientists that could be used in computer code$^2$?

$^1$ Yes, that means that something in, say, Sanskrit or Chinese would not be of much help.

$^2$ functionThatReturnsZeroForZeroInputAndOneOtherwise is not very helpful either...

• Yes, Kronecker delta, or Characteristic function, or Indicator function, as you said. Commented Feb 3, 2013 at 14:01
• actually, this would be one minus the Kronecker delta. Commented Feb 3, 2013 at 14:03
• Indeed, $x\mapsto 1-\delta_{0,x}$. In the theory of Boolean algebras (with operators), this is called the switching function or discriminator (though it means some more general thing in universal algebra). Commented Feb 3, 2013 at 14:05
• But, overall, I would call it simply NonZero(x). Commented Feb 3, 2013 at 14:08
• @Berci: to be honest I was hoping for a name that would not be confused with a function that returns a boolean value. Something along the lines of nonZeroIndicator() or something... Commented Feb 4, 2013 at 10:31

You might call it normalize () or canonicalize (), since it normalizes/canonicalizes a representation in which false / $0$ is represented by $0$ and true / $1$ can be represented by any non-zero value to a representation in which each of them is represented by only one "canonical" value, which can then be used e.g. in equality comparisons.