0
$\begingroup$

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

$\endgroup$
5
  • 1
    $\begingroup$ Yes, Kronecker delta, or Characteristic function, or Indicator function, as you said. $\endgroup$
    – Berci
    Commented Feb 3, 2013 at 14:01
  • 2
    $\begingroup$ actually, this would be one minus the Kronecker delta. $\endgroup$
    – J. Loreaux
    Commented Feb 3, 2013 at 14:03
  • 2
    $\begingroup$ 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). $\endgroup$
    – Berci
    Commented Feb 3, 2013 at 14:05
  • 1
    $\begingroup$ But, overall, I would call it simply NonZero(x). $\endgroup$
    – Berci
    Commented Feb 3, 2013 at 14:08
  • $\begingroup$ @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... $\endgroup$
    – thkala
    Commented Feb 4, 2013 at 10:31

1 Answer 1

2
$\begingroup$

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.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .