F(x)^m = SUM C(n1, n2, ..., nN) A_1^n1 A2^n2 ... A_N^nN * exp(-x(n1*a1+n2*a2+...+ nN*aN))
where the sum is carrier over ALL non-negative integers n1, n2, ..., nN such that n1+n2+...+nN = m. The above is a multinomial series.
My question, for me to find all the combinations of n1, n2, ..., nN that add to m and then evelate the term, I could use N nested loops where each runs from 0 to m. I will check every combination and select the ones that satisfy n1+n2+...+nN = m. However, this is prohibitive for large N and/or m.
Is there another way for efficient evaluation of the summation?
Thank you in advance.