I am stuck on converting $0$ to $1$ and any whole number greater than Zero to $0$. Is there a mathematical way for doing so?Also how to notate it when using it in a function?
Asked
Active
Viewed 3,653 times
3
-
You can simply declare a function $f$ that does that, that is allowed into math, it doesn't need a formula. Why do you need that? – Santropedro Mar 19 '17 at 03:48
-
@Santropedro $0*0$ remains $0$ – Romantic Electron Mar 19 '17 at 03:50
-
1Yes, I edited, sorry for that. Can you say what kind of formula, wich with symbols, are you looking for? sum, product, cosine, square root? – Santropedro Mar 19 '17 at 03:51
4 Answers
4
The simple$$f(x)=\begin {cases} 1&x=0\\0 &x \gt 0 \end {cases}$$ does just what you asked. As people unreasonably do not like definitions by cases, you could also say $1-H(x)$ where $H(x)$ is the Heaviside step function. Unfortunately definitions of the step function at zero differ, so you have to make clear that you mean $H(0)=0$.
Ross Millikan
- 374,822
-
I think I can use the Heaviside step function as $H(x-(x-1))$ where $x$ is my input.Thanks – Romantic Electron Mar 19 '17 at 04:06
-
Then you need to make sure people understand that $H(0)=1$. This also fails for fractional values between $0$ and $1$ but maybe your $x$ is always a whole number. – Ross Millikan Mar 19 '17 at 04:09
-
Yes it will always be a whole number , and $H(0)$ will never happen.It will always be $H(-1)$ or $H(1)$ – Romantic Electron Mar 19 '17 at 04:27
1
If one doesn't mind limits, we can say $$ \lim_{n\to\infty}\left(\frac{1-x^2+x^4}{1+x^4}\right)^n =\left\{\begin{array}{} 1&\text{if }x=0\\ 0&\text{if }x\ne0\ \end{array}\right. $$
robjohn
- 345,667
0
If $n$ is a nonnegative integer, what about:
$${1 \choose n+1}$$
If not what about,
$${1 \choose \lceil n+1 \rceil}$$
Ahmed S. Attaalla
- 18,518
0
$$ f(x) = \frac{1+(-1)^{2^{|x|}-1}}{2} = \begin {cases} 1&x=0\\0 &x \ne 0 \end {cases} $$
Borislav Aymaliev
- 101
- 4