I am in an Advanced Engineering math class at Cal Poly, SLO and in most of our homework we use piecewise functions such as f(x)= 1 for 0<x<1, -1, for 1<x<2, all else equals 0. In our class we use Maple to do our labs and homework but I prefer using Mathematica ( I also own the Student version of Mathematica and would like to use i for homework). How do I enter a piecewise funcion into Mathematica? In Maple the above funcion would look something like this:
f := x -> piecewise(x<0,0, x<1, 1, x<2, -1, 0);
Is there something similar in Mathematica? Thanks for any info.