Mathematica 9 is now available
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: [mg53713] Re: Multiple Sums in Mathematica
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Mon, 24 Jan 2005 03:37:39 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 1/23/05 at 2:02 AM, sbrandt at physics.wustl.edu (Sebastian Brandt)
wrote:

>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?

Put the iterators in a list and use Sequence. For example,

list = {{n, 1, 4}, {m, 2, 5}}; 
Sum[n + m, Evaluate[Sequence@@list]]
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Multiple Sums in Mathematica
  • Next by Date: Re: Multiple Sums in Mathematica
  • Previous by thread: Re: Multiple Sums in Mathematica
  • Next by thread: Re: Multiple Sums in Mathematica