MathGroup Archive 2005

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

Search the Archive

Re: Multiple Sums in Mathematica


Roland Franzius wrote:
> 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])]]]
> 

Sorry error, must be

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


-- 

Roland Franzius


  • Prev by Date: Re: Problems with ExtendGraphics/Delaunay Triangulation
  • Next by Date: Re: Maxima & Minima
  • Previous by thread: Re: Re: Multiple Sums in Mathematica
  • Next by thread: How to make 3d map w/ data?