# Sum Over Multiple Indices part 2 [duplicate]

Recently I asked this question as I was trying to see how to write a particular Identity. I asked about how to write the following sum:

$$\sum_{i_1+i_2+...+i_n=k}\binom{k}{i_1,i_2,...,i_n}\frac{f(i_1)f(i_2)...f(i_n)}{k!}$$

It is my "f" that is the topic of this question. My particular "f" are called Hypergeometric Bernoulli Numbers. The code I have to generate the numbers is below:

 g[m_, x] := x^m/(m! (E^x - T[m - 1, x]))


where

 T[m_, x_] := Sum[x^j/j!, {j, 0, m}]


The hypergeometric bernoulli numbers are extracted using the following

 b[m, n, M] = b[m_, n_, M_] := Coefficient[ n! Normal[Series[g[m, x], {x, 0, M}]], x, n]


Now I want to sum over the $n$ term defined in the bernoulli number, so I basically want the "f" I wrote in the formula to be replaced by "b[m,n,M]". I had two helpers submit sequences on the linked page but the way I am implementing them seems incorrect. I was hoping to have someone help me integrate the "b" into the expression for the "f". Thank you.

• Why the down vote? – Eleven-Eleven Dec 26 '14 at 21:07
• The $f$ in your equation above appears to take one argument. The b[m,n,M] which is supposed to replace $f$ takes three arguments. Can you clarify the relationship between b and $f$? – QuantumDot Dec 27 '14 at 4:23
• Sure. f was just a dummy function in the example that I gave earlier. I can choose any m and M I want and it shouldn't affect the identity's structure. For b, I am looking for the expression to have b[m,i[j],M] instead of f(i[j]). – Eleven-Eleven Dec 27 '14 at 13:15

This is an extended comment.

Use Set rather than SetDelayed to define T and g in closed-form.

T[m_, x_] = Sum[x^j/j!, {j, 0, m}]


(E^x*Gamma[1 + m, x])/m!

To demonstrate the increased efficiency of the closed-form (i.e., use of Set compared to SetDelayed)

T2[m_, x_] := Sum[x^j/j!, {j, 0, m}];

(T2[10, 2.3] // AbsoluteTiming)[[1]]/
(T[10, 2.3] // AbsoluteTiming)[[1]]


1.2

(T2[100, 2.3] // AbsoluteTiming)[[1]]/
(T[100, 2.3] // AbsoluteTiming)[[1]]


5.8

In your definition of g you left out a Blank in the LHS

g[m_, x_] = x^m/(m! (E^x - T[m - 1, x])) // FullSimplify


x^m/(E^x*(Gamma[1 + m] - m*Gamma[m, x]))

In your definition of b you have the memorization reversed (see http://reference.wolfram.com/language/tutorial/FunctionsThatRememberValuesTheyHaveFound.html)

b[m_, n_, M_] :=
b[m, n, M] = Coefficient[n! Normal[Series[g[m, x], {x, 0, M}]], x, n]

• Thank you for you input. What is the advantage of defining the above functions your way? (novice mathematica user) – Eleven-Eleven Dec 27 '14 at 14:23
• Efficiency. As originally shown, Set provides a closed-form rather than keeping the definition of the function as a Sum. Added timing comparisons for different definitions of T. You can experiment with different definitions for g. – Bob Hanlon Dec 27 '14 at 22:03