I think you uncovered a few things, all of which play nicely together. One is the sign function (sometimes called "signum" to distinguish it from "sine", although in part of the world that later is "sinus", which for native English speakers does not usually evoke images of a wave). Sign[x-p]
is -1 for x<p
, 0 for x==p
, and for x>p
. Which brings me to the next thing you learned, to wit, that these provide an alternate way to describe piecewise functions. More generally, there are numerous equivalences to be made between representations through Piecewise
(the Mathematica function of relevance for this), Abs
, Sign
, Arg
(used heavily in parametrized results from symbolic definite integrals), as well as the even trickier ways of hiding jumps in branch cuts e.g. with Sqrt
. And there are the close cousings to Sign
, HeavisideTheta
and UnitStep
, as noted by John Doty. Very important in many engineering areas as well as math (I believe Heaviside was himself an engineer).
How useful is all this? I'm not sure but my feeling is that there are situations in which substituting one representation of a discontinuous function for another can be a useful thing to do. I think we do some of this in definite integration in Mathematica although it' been a few years now and I do not recall the details.