1
$\begingroup$

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?

$\endgroup$
  • 6
    $\begingroup$ I'd use the first version. The ternary operator is not common notation in math papers and I at least would be confused by it. I suppose it might depend on the field though. $\endgroup$ – Denis Nardin May 17 '16 at 15:05
  • 4
    $\begingroup$ $f(x) = \delta_{x,1}$ or $f(x) = 1_{\{1\}}(x)$ $\endgroup$ – Steve Huntsman May 17 '16 at 15:06
  • 5
    $\begingroup$ I would write a sentence: "Define $f(x)=1$ if $x=1$ and $f(x)=0$ otherwise." $\endgroup$ – Tom Goodwillie May 17 '16 at 15:27
  • 1
    $\begingroup$ I think it's perfectly fine to use the ternary operator provided it's clearly defined (and provided it's used often enough to make the gain of space worth while). A compromise might be to write $f(x) = (\mathtt{if~}x=1\mathtt{~then~}1\mathtt{~else~}0)$. $\endgroup$ – Gro-Tsen May 17 '16 at 15:58
  • 4
    $\begingroup$ I use the ternary operator quite often in notes that I write for myself, and I would be happy if it were more widely accepted in the mathematical literature. I suggest that you make a LaTeX macro for it, so you can change back to more standard notation fairly easily if the referee complains. $\endgroup$ – Neil Strickland May 17 '16 at 16:47
1
$\begingroup$

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] $$

$\endgroup$
  • 2
    $\begingroup$ I also immediately thought of the Iverson bracket, and frequently find occasion to use it. However, perhaps just out of mathematical conservatism, I think that @TomGoodwillie's comment mathoverflow.net/questions/239098/… is better; if space is at such a premium, then prefer a written explanation to the use of what will for many readers be an ad hoc symbolism. (Of course, the same objection could have been urged against Recorde's use of '=' in place of 'equals', and I think it's good that it wasn't. :-) ) $\endgroup$ – LSpice May 17 '16 at 17:51
1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ I know that you explicitly don't advocate them, but I think that both of those have problems. As a representation theorist, I prefer to reserve $\chi$ for characters, rather than characteristic functions. I don't have any particularly principled objection to $\mathbb 1$ for characteristic functions; I just find it ugly. A modification of the Iverson bracket mentioned by @AdamP.Goucher, and which I have heard attributed to Kottwitz, uses brackets: $[\{1\}]$. Of course, a big problem with all of these is that they give no idea what the domain is! $\endgroup$ – LSpice May 17 '16 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.