Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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...

share|cite|improve this question
Yes, Kronecker delta, or Characteristic function, or Indicator function, as you said. – Berci Feb 3 '13 at 14:01
actually, this would be one minus the Kronecker delta. – J. Loreaux Feb 3 '13 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). – Berci Feb 3 '13 at 14:05
But, overall, I would call it simply NonZero(x). – Berci Feb 3 '13 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... – thkala Feb 4 '13 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.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.