Author 
Comment/Response 
Henry Lamb

10/03/03 7:18pm
UnitStep can be used to define piecewise functions regardless of the pieces or their domains. Think of it as a switch, which turns on a function piece within its domain and turns it off otherwise. The definition of UnitStep is
0, x<0,
1, x>=0.
To turn the switch on at some value of x, say x1, we need a term (xx1) in the argument of UnitStep. To turn it off at another value of x, say x2, we need a term (xx2) or (x2x). If we take the product of these, both terms must be positive for the switch to be on. This is true only if x is between x1 and x2.
For example, suppose you have a piecewise function defined as
f1[x],x<x1,
f2[x],x1<=x<x2,
f3[x],x<=x2
Here you have three pieces. The first piece begins at Infinity and ends at x1, so its term is
f1[x]UnitStep[(xx1)] or
f1[x]UnitStep[x1x].
The middle piece extends from x1 to x2, so its term is
f2[x]UnitStep[(xx1)(xx2)] or
f2[x]UnitStep[(xx1)(x2x)].
The third piece begins at x2 and ends at Infinity, so its term is
f3[x]UnitStep[(xx2)].
The complete function is then the sum of these terms.
URL: , 
