2

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!

H42
  • 3,469
  • 7
  • 17
  • 5
    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. – MarcoB Apr 30 '18 at 02:03
  • 1
    For completeness, since you are changing the head, you could also use a /. List -> Multinomial However, solution provided by @MarcoB is preferrable. – Bob Hanlon Apr 30 '18 at 02:41
  • Thanks. Tried all these methods and solved the problem. – H42 Apr 30 '18 at 04:20

1 Answers1

3

Suppose you want to calculate Multinomial on the following list:

list={1,2,3};

Use:

Multinomial@@list