This is the extension of my previous inquiry:
Is it possible to describe the Collatz function in one formula?
Can each of all functions be expressed in one formula? That is, can any function expressed with conditions(e.g. modular or interval conditions) be expressed without conditions or sub-functions?
For example, conditional function f(x) which $$f\left(n\right) = \begin{cases} 0 &\text{if } x<-1\\ 1 & \text{if } -1≤x<0 \\ 2 & \text{if } 0≤x<1 \\ 3 & \text{if } 1≤x \end{cases}$$ Can be described by
$$f\left(x\right)=\left[\arctan \left(x\tan \left(1\right)\right)\right]+2$$
You can probably find a clever formula to express the step function $H(x)=[x\ge0]$. $H(x)=\dfrac{x+|x|}{2x}$ almost does it. See also Iverson bracket.
Given that, then:
and so any function that is defined piecewise can be written using a linear combination of suitable $H$: if your function is equal to $h(x)$ in an interval $[a,b]$, just add $H(x-a)(b-x)h(x)$.
For instance, your function is $$ H(-1-x)\cdot 0+ H(x+1)H(0-x)\cdot 1+ H(x-0)H(1-x)\cdot 2+ H(x-1)\cdot 3 $$
But it does not seem worth the trouble when the piecewise definition is so much clearer.