Consider a function:
f(x)=0 for 0 ? x < 1
f(x)=1 for 1 ? x < 2
What is the function?
any help would really be appreciated. Thanks!
Consider a function:
f(x)=0 for 0 ? x < 1
f(x)=1 for 1 ? x < 2
What is the function?
any help would really be appreciated. Thanks!
You have a perfectly good function definition. There seems to be no actual question here.
You have defined the function on the range 0<=x<2. Following that, this function definition in Mathematica syntax matches only for the argument in that range. Then Piecewise is used to define the map. I suggest looking up Condition and Piecewise in the documentation for a full understanding.
f[x_ /; 0 <= x < 2] := Piecewise[{{0, x < 1}, {1, x < 2}}]
Plot[f[x], {x, -1, 3}, PlotStyle -> Thickness[.01]]