Re: Piecewise functions

*To*: mathgroup at smc.vnet.net*Subject*: [mg51565] Re: Piecewise functions*From*: koopman at sfu.ca (Ray Koopman)*Date*: Sat, 23 Oct 2004 00:21:46 -0400 (EDT)*References*: <cl9tau$7oi$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Luca <luca at nospam.it> wrote in message news:<cl9tau$7oi$1 at smc.vnet.net>... > I need to plot piecewise functions like: > > y(x) = x if x > 3 > y(x) = -x if -1 < x < 3 > y(x) = 1 else > > (should have been a system). > I found out in the guide the chapter about this, and I learned that it > is possible with the function UnitStep, which I know. Anyway, I found > it difficult to determine the equation of the function using this > method. Is it possible to do it simply writing everything like I did > before, more or less? i.e. without having to determine the equation > with the UnitStep function. y[x_] := Which[ 3 <= x , x, -1 < x < 3, -x, True , 1]