There are two main ways I believe.
1) use a series of nested if functions. It should be pretty clear how to do this, just keep using if's in the false expression to evaluate the next interval possibility.
2) use the fact that boolean expressions evaluate to 1 and 0 for true and false. It would look like
$x(x<1)+3(x=1)+(2-x^2)(1<x\leq 2)+(x-3)(x>2)$