Rewrite a piecewise function into a single expression

1.4k Views Asked by At

Consider a piecewise function . I want a general way to rewrite it , into the single expression . I know that for sign function there is a single expression but I'm looking for solve it generally.

2

There are 2 best solutions below

12
On

It is not always possible, and many of the times it is possible, it's only because we're hiding the piecewise definition behind a dedicated piece of notation. For instance, the function $f(x)=|x|$ is really the function $$ f(x)=\cases{x&if $x\geq0$\\-x&if $x<0$} $$It's just that this particular piecewise function is so common that we have established a specific piece of notation to make writing the function easier.

8
On

In one of your comments, you asked for a function, defined for all $x \in \mathbb{R},\,$ such that $$ f(x)=\cases{ 0 &\text{if}\; x < 0\\[3pt] 1 &\text{if}\; x > 0 } $$ Here's one trick which will bury the cases . . .

$$f(x)=\left\lfloor{\max\left(0\,,\frac{1+x}{1+|x|}\right)}\right\rfloor$$