TransWikia.com

To write mathematica code for summation using a given data

Mathematica Asked by user75105 on December 7, 2020

I am given a set like some terms from the partition of $20$:

${{17, 3}, {13, 7}, {11, 3, 3, 3}, {7, 7, 3, 3}, {7, 5, 5, 3}, {5, 5,
5, 5}}$
.

From the above data,

$20= underline{1}*17+underline{1}*3= underline{1}*13+underline{1}*7 =underline{1}*11+underline{3}*3 = underline{2}*7+underline{2}*3 = underline{1}*7+underline{2}*5+underline{1}*3 = underline{4}*5$

Now the above underlined numbers indicate the number of repetitions of each term appearing in the partition. I need to write those number of repetitions in the form of summation involving factorials:

Like for the above case, I need to represent the summation for the above partition as:

${T=frac{1}{1!*1!}+frac{1}{1!*1!}+frac{1}{1!*3!}+frac{1}{2!*2!}+frac{1}{1!*2!}+frac{1}{4!}}$

How can I do that?

2 Answers

fn=Tr[1/Times @@@ (Tally[#][[All, 2]] & /@ #!)]&;

fn@{{17, 3}, {13, 7}, {11, 3, 3, 3}, {7, 7, 3, 3}, {7, 5, 5, 3}, {5, 5, 
  5, 5}}

71/24

Answered by ciao on December 7, 2020

ip = {{17, 3}, {13, 7}, {11, 3, 3, 3}, {7, 7, 3, 3}, {7, 5, 5, 3}, {5, 5, 5, 5}};

Total[Times @@ Values[1 / Factorial @ #] & /@ Counts /@ ip]
71/24

Also

Query[Total, Times @@ Values[1/Factorial @ #] &] @ Dataset[Counts /@ ip]
71/24
Dataset[Counts /@ ip][Total, Times @@ Values[1/Factorial @ #] &]
71/24

Answered by kglr on December 7, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP