Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Let's say I have a piecewise function:

$$f(x) = \begin{cases}x ,& 0 \leq x \leq 1 \\1 ,& 1 \leq x\end{cases}$$

How can I rewrite this in terms of the Heaviside function $u(x-a)$?

share|improve this question

4 Answers 4

up vote 3 down vote accepted

I gave a good rundown of a mechanical method here. The main idea is to change everything to Iverson brackets before finally switching to the unit step function, since there is the relationship

$$[x\geq a]=[x-a\geq0]=\begin{cases}1&\text{if }x-a\geq0\\0&\text{if }x-a<0\end{cases}=u(x-a)$$

With

$$f(x) = \begin{cases} x & 0 \leq x < 1 \\ 1 & 1 \leq x \end{cases}$$

(and assuming that the function is zero in all other cases), translation to the Iverson convention is easy:

$$f(x)=x[0 \leq x < 1]+[1 \leq x]$$

and we can then do some massaging:

$$\begin{align*} f(x)&=x[0 \leq x < 1]+[1\leq x]\\ &=x[x \geq 0][x < 1]+[x-1 \geq 0]\\ &=x[x \geq 0][\lnot(x \geq 1)]+[x-1 \geq 0]\\ &=x[x \geq 0](1-[x \geq 1])+[x-1 \geq 0]\\ &=x[x \geq 0](1-[x-1 \geq 0])+[x-1 \geq 0]\\ &=x[x \geq 0]-x[x \geq 0][x-1 \geq 0]+[x-1 \geq 0]\\ &=x\,u(x)-x\,u(x)u(x-1)+u(x-1)\\ \end{align*}$$

where the properties $[p\text{ and }q]=[p][q]$ and $[\lnot p]=1-[p]$ of the Iverson bracket were useful.

One can do a further simplification, since $u(x)u(x-1)=[(x \geq 0)\text{ and }(x \geq 1)]=[x \geq 1]=u(x-1)$. We then finally have

$$f(x)=x\,u(x)-x\,u(x-1)+u(x-1)=x\,u(x)+(1-x)u(x-1)$$

share|improve this answer

At $x=0$ the slope grows of $1$ adding a term $x\cdot u(x-0)$
At $x=1$ the slope change ends subtracting a term $(x-1)\cdot u(x-1)$

So that $f(x)=x\cdot (u(x-0)-u(x-1))+u(x-1)$.

share|improve this answer

Given the pieces your function is made of, you want to look for functions g(x) and h(x) such that f(x)=g(x)u(x)+h(x)u(x-1). I let you determine the functions g and h.

share|improve this answer

In general, assuming that the conditions $c_1, \ldots, c_n$ are mutually exclusive, the translation would be $$ \begin{eqnarray*} f(x) & = & \begin{cases} f_1(x), & c_1 \\ \ldots \\ f_n(x), & c_n \\ \end{cases} \\ & = & f_1(x) \cdot \mathcal{U}(c_1) + \ldots + f_n(x) \cdot \mathcal{U}(c_n) \end{eqnarray*} $$ where $\mathcal{U}(c_n)$ is the encoding of $n$th condition.


Relevant: Superposition Principle used a lot in engineering.

share|improve this answer
    
The translation is $${\cal U}(x - a \ge 0) = u(x - a) \\ {\cal U}(x - a > 0) = u(x - a - \epsilon) \\ {\cal U}(a \le x \le b) = {\cal U}(x \ge a) - {\cal U}(x \ge b) $$ where $0 < \epsilon \le 1.$ –  user2468 Mar 25 '12 at 0:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.