Re: Multiple Sums in Mathematica

*To*: mathgroup at smc.vnet.net*Subject*: [mg53702] Re: Multiple Sums in Mathematica*From*: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>*Date*: Mon, 24 Jan 2005 03:37:23 -0500 (EST)*References*: <csvir2$avi$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Here is an example of what you could do: With[{m=2,n=4}, Apply[ Sum, Prepend[ Table[{i[k],m},{k,n}], Apply[f,Table[i[k],{k,n}]] ] ] ] f[1,1,1,1]+f[1,1,1,2]+f[1,1,2,1]+f[1,1,2,2]+f[1,2,1,1]+f[1,2,1,2]+f[1,2,2,1]+ f[1,2,2,2]+f[2,1,1,1]+f[2,1,1,2]+f[2,1,2,1]+f[2,1,2,2]+f[2,2,1,1]+ f[2,2,1,2]+f[2,2,2,1]+f[2,2,2,2] Steve Luttrell "Sebastian Brandt" <sbrandt at physics.wustl.edu> wrote in message news:csvir2$avi$1 at smc.vnet.net... > Hello, > > I want to perform a nested sum, where the number of summations is not > specified. I.e., I am looking for a way to implement the sum > > sum[ f, {i1, 1, M}, {i2, 1, M}, ..., {in, 1, M} ] > > Does anbody know how to do this for arbitrary n? > > Regards, > > Sebastian Brandt >