Define
$$\hat{X}(Y) = [X,Y] $$
I have known matrices $S_i$ and $V$. I am trying to use Mathematica to define a function which calculates
$$ \sum_{\substack{n_1, \ldots, n_k>1\\ n_1+\ldots n_k = m}} \hat{S}_{n_1}(\hat{S}_{n_2}(\ldots (\hat{S}_{n_k} (V))\ldots )) $$
for arbitrary integers $k$ and $m$ (with $k,m < 10$ or so). The matrices $S_i$ and $V$ are maybe up to $8 \times 8$ so I'm not too worried about speed or anything. Also note that I am able to access the $S_i$ by S[i]
.
I have a few questions.
1) Here the summation is over a somewhat complicated set of indices. There is the constraint that there must be exactly $k$ indices and that those indices must all add up $m$. I know that I can use
Select[Flatten[Permutations /@ IntegerPartitions[m], 1], Length[#] == k &]
to get a list of sets of indices which satisfy this constraint but I don't know how to sum over these indices other than using a loop and even then I'm not entirely sure how to do it.
2) Using the hat notation it is very easy to string together multiple commutators in writing. I'm not so sure how to string together a variable number of commutators with variable arguments. Again I feel there is a way I could do this with a loop but I'm not exactly sure.
At present I'm trying to construct loops to implement this summation but I'm not sure if it will work and even if it does it does not seem very elegant.
Could anyone provide me with a nice way to calculate this expression?