I have a function that defined as following
$$f(x) = \begin{cases} 1, & \text{if $x > 0$ } \\ 0, & \text{if $x=0$ } \\ -1, & \text{if $x<0$ } \end{cases}$$ In practice, the $f(x)$ is approximated by a smooth $\tanh(kx)$ or Heaviside function as bellow figure. Could you have other way to represent the $f(x)$ function? What are the benefits of your way?
Update: $\tanh(kx)$ function $k$ controls the smoothness of the sign function. As $k \to \infty$, the function defined in $f(x)=\tanh(kx)$ converges to standard sign function. Similarly, the derivative of $\tanh(x)$ also converges to Dirac delta function as $k \to \infty$. If $k$ is too small, the evolution equation for $x$ acts locally only on a few values around $\{x=0\}$. Hence, the $\tanh(kx)$ function is sensitive with parameter $k$. The parameter $k$ must be chosen carefully.
Hence, My purposed want to reduce/ignore the affect of k, but remains the above smoothly approximation.