sequence of sums of binomial coefficients

Hi everyone. I would like to define a following sequence:

sum_(I=1)^2 (2 binomial i)

sum_(j=1)^2 (sum_(i=1)^2 (2 binomial i)*(2 binomial j))

sum_(l=1)^2 [sum_(j=1)^2 (sum_(i=1)^2 (2 binomial i)(2 binomial j)(2 binomial l))]

etc

How could I define such a sequence in mathematica without relying on having different letters for different sums (as i,j,l). Notice that I can’t write it down as Sum[ Product[Binomial[2,i]^n,{n,1,..}] , {i,2,2} ], for example, since it counts only a subset of realizations needed. Thanks a lot for your help!

Is this what you are looking for? Or can you adapt this technique to get what you need?

First just show the constructed strings to try to be able to verify this is correct:

In[1]:= sumbinomial[n_] :=
 StringJoin[
  Join[
   Table["Sum[", {i, 1, n}],
   Table["Binomial[2,i" <> ToString[i] <> "],{i" <> ToString[i] <> ",1,2}]", {i, 1, n}]
   ]
  ]

In[2]:= FullForm[sumbinomial[1]]

Out[2]//FullForm= "Sum[Binomial[2,i1],{i1,1,2}]"

In[3]:= FullForm[sumbinomial[2]]

Out[3]//FullForm= "Sum[Sum[Binomial[2,i1],{i1,1,2}]Binomial[2,i2],{i2,1,2}]"

In[4]:= FullForm[sumbinomial[3]]

Out[4]//FullForm= "Sum[Sum[Sum[Binomial[2,i1],{i1,1,2}]Binomial[2,i2],{i2,1,2}]Binomial[2,i3],{i3,1,2}]"

Now the actual function, which just wraps that with ToExpression to interpret the string and carry out the calculation:

In[5]:= sumbinomial[n_] :=
 ToExpression[
  StringJoin[
   Join[
    Table["Sum[", {i, 1, n}],
    Table["Binomial[2,i" <> ToString[i] <> "],{i" <> ToString[i] <> ",1,2}]", {i, 1, n}]
    ]
   ]
  ]

In[6]:= sumbinomial[1]

Out[6]= 3

In[7]:= sumbinomial[2]

Out[7]= 9

In[8]:= sumbinomial[3]

Out[8]= 27

There should be a clear, simple, easy to understand recursive definition which does exactly what you want, but without the string hacking. Getting all the iterations correctly might be difficult to do until you think about functional programming just the right way.

Hi Bill, thanks a lot for that.
On the one hand, for the above problem I reformulated the formulas mathematically making them a function of (binomial[2,i])^x*binomial([2,2])^(k-x) for some k,x.

But for more complicated examples in my model, I have to use recursive definitions you described above. I still need a bit of time to go through it since my experience with mathematica is limited atm.