Expression for a bounded function

132 Views Asked by At

I have a bounded function,

$$ y= \begin{cases} 1 & \text{if $x>1$} \\ x & \text{if $0\leq x\leq 1$}\\ 0 &\text{if $x < 0$} \end{cases} $$ Does anyone know any simple math function to represent $y$? (not using a piece-wise function)

For example, Heaviside function is a similar approach.

Thanks

5

There are 5 best solutions below

0
On

$$y=x[x>0] + (1-x)[x>1]$$ Where $[x>0]$ denotes the Iverson bracket, equalling $1$ if the expression is true, and $0$ otherwise. You can also use an indicator function if you prefer.

0
On

Let $H$ denote the unit step function.

$xH(x)$ is zero when $x$ is negative and equal to $x$ when $x$ is positive. $xH(x-1)$ is zero when $x$ is less than 1 and equal to $x$ otherwise. If I'm not mistaken, $$xH(x) - (x-1)H(x-1)$$ is the function you want.

0
On

There is a nice notation for this: $y=(x\wedge 1)\vee 0$.

Note: this is just shorthand for $y=\max (\min(x,1),0)$.

2
On

$$ \int \rm rect\left( x- \frac12\right)\rm dx, $$ but be careful when choosing $\rm{const}$...

1
On

$$ f(x) = \frac{|x|+x}{2} - \frac{(x-1)+|x-1|}{2}. $$

(This can be simplified a bit.)