12
$\begingroup$

I know how to type a fraction as you would write a fraction in Mathematica (9). How do you type Binomial[n,k] as $\binom{n}{k}$ in Mathematica? Is there a single reference page that contains all the Mathematica operations like this, that you can type in math notation?

$\endgroup$
4
  • $\begingroup$ I just realized that this might conflict with typing vector notation (CTRL+Enter), so probably the way to do this is to type $\frac{n!}{(n-k)!k!}$ $\endgroup$
    – Identity
    Dec 6, 2013 at 1:56
  • $\begingroup$ What exactly are you trying to achieve? (1) Just display something? (2) Interpret that displayed form as Binomial? (3) Or display Binomial in that form? TraditionalForm will do (3). Use Ron's answer for (1). (2) is not simple and I don't recommend it. When talking to computers it's best to stick to a clear, unambiguous notation (which the usual math notation is not---it always relies on a human reader who understands the problem and the context). $\endgroup$
    – Szabolcs
    Dec 6, 2013 at 2:05
  • $\begingroup$ Here's a reason not to force these things. There's a difference between those two inputs but you can't see it. The first one was created by transforming the cell to TraditionalForm. The second one was input directly as a visual form. $\endgroup$
    – Szabolcs
    Dec 6, 2013 at 2:07
  • $\begingroup$ @Szabolcs to (2) type that in displayed form and have Mathematica interpret it as Binomial. Yes, a little while after I asked this, I realized why (2) would be a problem. $\endgroup$
    – Identity
    Dec 6, 2013 at 2:33

2 Answers 2

13
$\begingroup$

The possibility to insert operators and functions as you know them from mathematics is not possible for all things. Usually, you find the special input possibilities on the reference page of the function in the Details section. See for instance the documentation of Integrate.

For Binomial there seems to be no such 2d input, because as you already found out, $\binom{n}{k}$ is interpreted as vector.

The 2d input should in general be used with care, because it is sometimes harder to spot errors. And, when you want to copy a nice looking

Mathematica graphics

into a text editor or to this site, you end up with

\[Integral]Sqrt[x + Sqrt[x]] \[DifferentialD]x

which just looks awful.

Edit

Szabolcs came up with the idea that you could make a button for your needs. To see how this is derived, you first look at the TraditionalForm of Binomial

Binomial[n, k] // TraditionalForm

Mathematica graphics

Now you go in the output cell and navigate to Cell->Show Expression

Cell[BoxData[
 FormBox[
  TemplateBox[{"n","k"},
   "Binomial"], TraditionalForm]], "Output",
 CellChangeTimes->{3.5952851298543243`*^9, 3.595285236592402*^9}]

At this point, you see the you need to create the inner TemplateBox and therefore

DisplayForm[
 ButtonBox[
  TemplateBox[{"\[SelectionPlaceholder]", "\[SelectionPlaceholder]"}, 
   "Binomial"], BaseStyle -> "Paste"]]

Mathematica graphics

creates a button which lets you insert Binomial as correct 2d expression.

$\endgroup$
2
  • $\begingroup$ Here's a paste button: PasteButton[ RawBoxes@TemplateBox[{"\[SelectionPlaceholder]", "\[SelectionPlaceholder]"}, "Binomial"]]. You could update your answer with it. $\endgroup$
    – Szabolcs
    Dec 6, 2013 at 2:21
  • $\begingroup$ @Szabolcs Thanks, I updated the post. $\endgroup$
    – halirutan
    Dec 6, 2013 at 2:24
4
$\begingroup$

I would use the menu option Cell | ConvertTo and select TraditionalForm. The keyboard shortcut for this in OSX is Shift + Command + T. Here is an animation showing this in action:

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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