2
$\begingroup$

I have a = {1, 2, 3}, and want to obtain Multinomial[1, 2, 3], which is 60.

But when I input Multinomial[a], the input a is the entire list so I got {1, 1, 1}. That is, I need to separate a from a single list into separated elements so that I can input them correctly.

Multinomial[Flatten[a]] also doesn't work, since the last bracket can't be removed by Flatten. What can I do?

Thanks!

$\endgroup$
  • 5
    $\begingroup$ Multinomial @@ a, which in full form would be Apply[Multinomial][a] or Apply[Multinomial, a]: look up Apply. Think of Apply as changing the head of an expression, in this case from List to Multinomial. Tangentially, the arguments to Multinomial should be a Sequence. $\endgroup$ – MarcoB Apr 30 '18 at 2:03
  • 1
    $\begingroup$ For completeness, since you are changing the head, you could also use a /. List -> Multinomial However, solution provided by @MarcoB is preferrable. $\endgroup$ – Bob Hanlon Apr 30 '18 at 2:41
  • $\begingroup$ Thanks. Tried all these methods and solved the problem. $\endgroup$ – H42 Apr 30 '18 at 4:20
3
$\begingroup$

Suppose you want to calculate Multinomial on the following list:

list={1,2,3};

Use:

Multinomial@@list
$\endgroup$

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