2
$\begingroup$

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?)?

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

2 Answers 2

4
$\begingroup$

The calling Sequence in Maple is as follows:

[> binomial(5, 2);

10
$\endgroup$
1
  • $\begingroup$ Short and sweet! +1 $\endgroup$
    – amWhy
    Dec 16, 2013 at 23:54
2
$\begingroup$

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.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .