Identity function that returns $1$ for the input $0$. I'm looking for a way to write the following function:
\begin{equation}
id(x) = \begin{cases}
x & x \neq 0 \\
1 & x = 0
\end{cases}
\end{equation}
However, I want to implement it without using conditionals. Any ideas? The simpler, the better.
 A: How about $$f(x) = x + 0^{|x|}$$
A: As @JohnHughes points out, normal algebra can't help you. If you're willing to use the Kronecker delta function  then
$$
f(x) = x + \delta(x,0)
$$
does what you want.
A: This can be achieved merely with the arctan and tangent function.
The functions $z_1, z_2, z_3$, return $1$ when $x = 0$, and $0$ when $x \neq 0$. Notice this is different than your $id$ function, but will be used to construct it. 
$$
z_1(x) = 2^{\lceil |x|\rceil} \text{ mod } 2
$$
$$
z_2(x) = 1 - |\text{sign}(x)| 
$$
$$
z_3(x) = 1 - \bigg\lceil\frac{|x|}{|x| + 1}\bigg\rceil
$$
The absolute values can also be replaced with squares, i.e.
$$
z_3(x) = 1 - \bigg\lceil\frac{x^2}{x^2 + 1}\bigg\rceil
$$
Source: I spent a lot of time trying to write conditional functions without conditionals.
Note: 
$$\lfloor x \rfloor = (x - 0.5) - \frac{\arctan(\tan(\pi(x - 0.5)))}{\pi}$$
Then we can write
$$\lceil x \rceil = -\lfloor -x \rfloor$$
So, we can write $z_3$ merely from arctan and tan:
$$ z_3(x) = 1 + \bigg\lfloor - \frac{x^2}{x^2 + 1}\bigg\rfloor = 1 - \frac{x^2}{x^2 + 1} - 0.5 - \frac{\arctan(\tan(\pi(- \frac{x^2}{x^2 + 1} - 0.5)))}{\pi}$$
Then,
$$id(x) = z_3(x) + x\cdot(1 - z_3(x))$$
Not pretty, but is entirely in terms of elementary functions.
