Use of ternary operator in formal writing I would like to write
$$
f(x) = \begin{cases}1&\mbox{if }x = 1\\ 0&\mbox{otherwise.}\end{cases}
$$
However, this eats up a lot of vertical space for a very simple statement. Is there agreed upon or common notation to inline this into a single normal-height line in technical writing? As a computer scientist I am tempted to write
$$
f(x) = (x=1\,?\,1 : 0),
$$
which is the notation of the common programming notation for the ternary operator. If you were reviewing a paper that did this (saying that it used the ternary operator notation of C++) would you declare it an abomination? Is there an alternative that you would consider?
 A: The ternary operator doesn't seem to be used in mathematical papers, with the vertical brace notation being the most popular option. If there is a strong reason for not using the vertical brace (such as it being embedded in a more complicated expression), I would suggest using the Iverson bracket:
https://en.wikipedia.org/wiki/Iverson_bracket
in which case you would write $f(x) = [x = 1]$. Even then, the Iverson bracket might not necessarily be known to your reader, in which case you could use the vertical brace the first time you introduce the Iverson bracket:
$$ f(x) = [x = 1] := \begin{cases}1&\mbox{if }x = 1\\ 0&\mbox{otherwise.}\end{cases} $$
Then, any subsequent time you use the Iverson bracket, its meaning should be understood without the need for a clarifying brace:
$$ \delta_{ij} = [i = j] $$
A: Even the Iverson bracket is used only in certain parts of mathematics.  If the "cases" notation is absolutely ruled out (perhaps because it is to be used a few hundred times), then my inclination is to follow Steve Hartsman and use the indicator function (a.k.a. characteristic function)
$$
f = \mathbb{1}_{\{1\}}
\\
f = \chi_{\{1\}}
$$
or similar.
