# In maple how do you evaluate combinations?

In Maple how do you have it evaluate combinatorics such as $\binom{5}{2}$ and give you the answer 10? (What is the name of what I want to do anyways, is it evaluate?)

Thanks. Seems so easy now that I know. How would you do permutations (and for that matter how do you even write them in LaTex?)?

• binomial(5,2); will give the answer 10, or did I miss something obvious? Dec 16, 2013 at 11:14
• with(combinat): numbperm(3,2); will give 6. Dec 16, 2013 at 11:27

The calling Sequence in Maple is as follows:

[> binomial(5, 2);

10

• Short and sweet! +1 Dec 16, 2013 at 23:54

Others have already pointed out that a working (plaintext) 1D Maple notation for your example is,

binomial(5,2)


You can also get a pretty-printed 2D Math input form for this, using either the palettes or command-completion.

Suppose you are in 2D Math input mode (the input cursor will appear slanted, rather than upright, in this mode). That's the default which you may change as a preference, but F5 will also toggle between 1D and 2D input modes on MS-Win and Linux at least.

If you are in 2D Math input mode then there is an item for entering the typeset form of binomial(5,2) available in the Expression palette. If you select that entry then a template for it is inserted at the cursor position and you can fill in the two arguments for it. Use tab to go from the first to the second.

Alternatively, if you are in 2D Math input mode then you can use command-completion to get the same template at the cursor position. Type in, binom and then activate command-completion. On Linux it is done with Ctl-Shift-Spacebar. Select the top item from the popup list that appears.

You can also get expressions such as binomial(m,n) to be be typeset similar to LaTeX \binon{m}{n} when they appear as output, but it requires changing a preference. It needs the so-called "extended" typesetting level. You can toggle this preference with the command,

interface(typesetting=extended):


or you can set the preference with the GUI, eg. Tools-Options->Display->Typesetting level and save that either globally or just for the current session.