function that is 1 when x=0 and 0 otherwise

2.1k Views Asked by At

I'm wondering if there is a function, or an easy way I can create a function from other elementary functions, such that $f(x)$ is $0$ whenever $x\neq0$ and $1$ whenever $x=0$. So, a function kind of like the loose/informal definition of the Dirac Delta function but with $\infty$ being $1$. Thanks!

1

There are 1 best solutions below

2
On BEST ANSWER

You have alluded to the Dirac Delta "function"; let me introduce you to the Kronecker Delta function:

$$\delta_{ab} := \begin{cases} 1; \ a = b\\ 0; \ a \ne b \end{cases}$$

Where $a,b$ don't have to be numbers, but they can be.

So you can write:

$$\delta_{x,0} = \begin{cases} 1; \ x = 0\\ 0; \ x \ne 0 \end{cases}$$

In WolframAlpha, you can write kroneckerdelta(x,0)

Edit: Another option is the Iverson Bracket.

$$[P(x)] := \begin{cases} 1; \ P(x) \\ 0; \ \neg P(x) \end{cases}$$

Where $P(x)$ is some prepositional function. So you can write:

$$[x = 0] = \begin{cases} 1;\ x = 0 \\ 0; \ x \ne 0 \end{cases}$$

In WolframAlpha, you can write Boole(x=0)