How to represent sign function in range $[-1, 1]$ I have a function that is defined as follows:
$$f(x) =
\begin{cases}
1  & \text{if $x \ge0$}, \\
-1 & \text{if $x<0$}.
\end{cases}$$
I would like to represent the above function by the sign function. Could you help me represent it
$$f(x)=\operatorname{sign}(x)...???$$

You can try
$$
f(x)=\mathrm{sgn}\!\left(\mathrm{sgn}(x)+\frac12\right)
$$
