# Sum over partitions of a number

I know only some basics about mathematica. However I need to write down the following sum:

$\sum_{\{m_k\}_N}\prod_{k=1}^N\frac{1}{m_k}[T_k(Z(\tau))]^{m_k}$.

Where $\{m_k\}_N$ denotes partitions of $N$ i.e. $\sum_{k=1}^Nkm_k=N$. The argument in brackets [..] is the Hecke Operator, for now not that important. My problem is more that I do not know how to write the sum over partitions. The Hecke Operator I would then just insert and I think this would not be the most difficult part.

I know that usually I should write some code expressing my trials however I really have no idea how to handle the problem. Could someone please help me.

• Could you explain, maybe with a simple by-hand example, how do you want to sum over partitions? As IntegerPartitions[4] gives a set of sets, so I don't fully understand. – corey979 Mar 27 '17 at 15:16
• Sure: Take the example $N=3$. Then we have: $1\cdot 3=3 \Rightarrow m_1=3$, $1\cdot 1 + 1\cdot 2 = 3 \Rightarrow m_1=1, m_2=1$, $3\cdot 1=3 \Rightarrow m_3=1$. Thus the above sum up to prefactors is: $(T_1Z(\tau))^3 + T_1Z(\tau)T_2Z(\tau) + T_3Z(\tau)$. – user404302 Mar 27 '17 at 15:23
• This is not exactly what IntegerPartitions does. – user404302 Mar 27 '17 at 15:24
• Look up FrobeniusSolve[]. – J. M.'s torpor Mar 27 '17 at 16:05

Tally transforms IntegerPartitions into what you need:

Total[Times @@@ Map[Last[#]^-1 T[First[#], Z[\[Tau]]]^Last[#] &,
Tally /@ IntegerPartitions[3], {2}], {1, 2}]

• This is my outcome: $T[1, Z[\[Tau]]] + T[1, Z[\[Tau]]]^3 + T[2, Z[\[Tau]]] + T[3, Z[\[Tau]]]$. It is not exactly what I want. But I think I get what you mean. – user404302 Mar 27 '17 at 16:43
• or actually I do not get it, could you please explain your code? – user404302 Mar 27 '17 at 16:49
• what is the meaning of the $\{1,2\}$ at the end? – user404302 Mar 27 '17 at 16:57
• @user404302 I edited so that numbers from same partition are multiplied, and added the division by $m_k$. Total[#,{1,2}]& sums the numbers of a matrix or non-rectangular 2d array (as in this case) – Coolwater Mar 27 '17 at 17:25
• So now I get it, thank you – user404302 Mar 27 '17 at 18:01

As I noted in the comments, using FrobeniusSolve[] in Sum[] is the most convenient way to implement the sum:

With[{n = 3},
Sum[Product[If[m[[k]] != 0, tz[k]^m[[k]]/m[[k]], 1], {k, Length[m]}],
{m, FrobeniusSolve[Range[n], n]}]]
tz[1]^3/3 + tz[1] tz[2] + tz[3]