# I have discovered an algebraic way to represent Piecewise functions

I was fiddling with some graph theory ideas and with piecewise functions, and I made a startling discovery. I found out that if you consider the function, $$f\left(x,k\right)=-\lfloor\left(\frac{x-k}{\left(abs\left(x-k\right)+1\right)}\right)\rfloor$$ where $$\lfloor{x}\rfloor$$ is the floor function, or smallest integer function  and two arbitrary functions $g(x)$ and $h(x)$, you can create a piecewise function of the form $$t(x)=\begin{cases}g(x) & x \leq k\\h(x) & x > k\end{cases}$$ by simply creating $$t(x)=f(x,k)g(x)+(1-f(x,k))h(x)$$ this may seem complicating, but basically the function $f$ return a value of $-1$ from $-\infty$ to $k$ and returns 0 from $k$ to $\infty$. I use this to my advantage in order to provide a multiplier in order to make the graph of $t$ either $g$ of $h$ depending on the value of $k$. What I am wondering is, has this been discovered already and is this significance? I spend quite some time creating $f$ such that it is defined for all reals. So the domain of the algebraic piecewise should be the domain of $g$ up to and including $k$ and the domain of $k$ and beyond should be the domain of $k$, exactly as it would be in the piecewise. On another note, you can also find an algebraic piecewise for two functions and use it to create another algebraic piecewise, effectively being able to create piecewise of as many functions as you wish, in any parts of the domain you want.

• That works, but define algebraic way. Otherwise put, why would your $f(x,k)$ (and the floor function) be more "algebraically" acceptable than other step functions out there. – dxiv Dec 17 '17 at 7:25
• Sorry to burst your bubble, but this is in no way a startling discovery. It is barely a discovery at all in the first place. If anything, it is overly complicated and unnecessary for any practical purpose. – dezdichado Dec 17 '17 at 7:26
• By practicality, I meant more in the direction of graph theory and creating a closed form expression for a specific graph – ShadowBond Dec 17 '17 at 7:27
• No, the minus sign is intentional. Is because without it, the function returns either -1 or 0 – ShadowBond Dec 17 '17 at 7:40
• $1_{x > 0} = \frac{\max(x,0)}{x}=\frac{|x| + x}{2x}$ this is trivial. – reuns Dec 17 '17 at 8:13