Consider:
Can someone explain why the 0, True occurs?
As a second question, I like to fill the endpoints as follows:
Plot[f[x], {x, -2, 2},
Epilog -> {Blue, PointSize[Large],
Point[{{-1, 3}, {-1, -1}, {1, 1}, {1, 0}}],
White, PointSize[Medium],
Point[{{-1, 3}, {1, 1}}]
}]
Does anyone use an easier method for filled and unfilled endpoints?
Update: A lot of folks mentioned the possibility that x could be a complex number. I gave that a try. Watch what happened.
So I still am not sure how to explain this 0, True situation to my students.


Piecewise. If none of the conditions above it evaluate toTrue, then the last condition automatically evaluates toTrue, and the function spits out a 0. You can change that default by explicitly putting in, say{-1, True}.Piecewisetests its arguments in order: for example, ponder on the output when you evaluatePiecewise[{{-1, True}, {1, x > 0}}]. – march Dec 17 '15 at 04:20xbe a complex number? It will default to0in that case. – Greg Hurst Dec 17 '15 at 05:11f[x_] = Piecewise[{{2 - x, x < -1}, {x, -1 <= x < 1}, {(x - 1)^2, x >= 1}}]. The conditions $x<-1$, $-1\le x<1$, and $x\ge 1$ cover every possible value of $x$, so I wonder why an extra condition is needed. – David Dec 17 '15 at 05:37x. There might also be something about the implementation ofPiecewisethat makes that sort of thing difficult. For possible hints of that, take yourf[x],Simplifyit, and look at the output. – march Dec 17 '15 at 06:09f[x_] = Piecewise[{{2 - x, x < -1}, {x, -1 <= x < 1}}, (x - 1)^2]andf[x_] = PiecewiseExpand[f[x], Assumptions -> Reals]. – David Dec 17 '15 at 20:26