# Mathematical function to check whether its parameter is zero or not

i need a mathematical function F which is defined as F(x) = 0 if x equal to zero and F(x) = 1 if x is not equal to zero. can F(x) be represented in the form of a single mathematical expression in terms of x?

-
Hi Anil. Welcome to stackexchange. Hope you will get an answer soon. (the guy from Vark.com) –  mplungjan Feb 25 '11 at 13:41
You can write it as $1_{\mathbb R\setminus\{0\}}(x)$ but that is just a name. What do you mean with "a single mathematical expression"? –  Rasmus Feb 25 '11 at 13:45
You have already defined the function. What more do you need? –  Qiaochu Yuan Feb 25 '11 at 13:48
These types of questions usually arise from a limited understanding of functions. A function (in a limited point of view) is a machine which returns a number, if you supply the function a number. As an example you can define the absolute value as $|x|=\sqrt{x^2}$. Is this a better definition than $x=x$ if $x\geq 0$, and $x=-x$ is $x<0$? If you think so, you should ask yourself: how do you define the square root? –  Thomas Rot Feb 25 '11 at 14:15
If you let $S$ be the set containing $0$ then $F(X)$ is often called the characteristic (or indicator) function of $\mathbb R - S$. It already is a single mathematical definition for any $x \in \mathbb R$, but maybe you are looking for a concise way to describe it? –  Joshua Shane Liberman Feb 25 '11 at 14:34
show 1 more comment

## 2 Answers

Knuth suggests using the Iverson bracket notation $[x\ne0]$ for that function. You can also try $|\mbox{sgn}(x)|$. See http://en.wikipedia.org/wiki/Sign_function

-
add comment

Any algorithm that does what you want will be dependent upon the F(x) you are working with. Some F's are easy-for x^2 you can take the integer sqrt of x, square it, and see if you get x back again. For x^x you could just store a table of them up to the largest number of interest and search the table. Unless you are doing arbitrary precision work it will be much less than 1000 entries.

-
add comment