Re: Multiple Sums in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg53700] Re: Multiple Sums in Mathematica
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Mon, 24 Jan 2005 03:37:21 -0500 (EST)
- References: <csvir2$avi$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Sebastian Brandt wrote: > 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 > Hi, I think you want something like this: xx = {{i, 1, 2}, {j, 1, 2}, {k, 1, 2}}; Sum[f[i, j, k], Evaluate[Sequence @@ xx]] David Bailey dbaileyconsultancy.co.uk