Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Multiple Sums in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53719] Re: Multiple Sums in Mathematica
  • From: Roland Franzius <roland.franzius at uos.de>
  • Date: Tue, 25 Jan 2005 05:03:13 -0500 (EST)
  • Organization: Universitaet Hannover
  • 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?

s[n_] := sum[f, Sequence[
       ToExpression["{i" <> # <> ",1,M}" & /@ (ToString /@ Range[n])]]]

-- 

Roland Franzius


  • Prev by Date: Re: Numbers and their reversals
  • Next by Date: FromDigits[{135,21}] -> 1371 (??!!)
  • Previous by thread: Re: Multiple Sums in Mathematica
  • Next by thread: Re: Multiple Sums in Mathematica