MathGroup Archive 2011

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

Search the Archive

Re: How to create such a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118487] Re: How to create such a list
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Fri, 29 Apr 2011 07:34:21 -0400 (EDT)

On 4/28/11 at 6:37 AM, dominic.woerner at mpi-hd.mpg.de (Dominic
Woerner) wrote:

>I like to create a list of the form:
>0,w[1],...,w[n],w[1]+w[2],...,w[1]+w[n],w[2]+w[3],......,w[1]+...+w[
>n] for arbitrary n Is there a neat way to do this?

Easily done with:

In[5]:= FoldList[Plus, 0, Table[w[n], {n, 4}]]

Out[5]= {0,w(1),w(1)+w(2),w(1)+w(2)+w(3),w(1)+w(2)+w(3)+w(4)}



  • Prev by Date: Re: How to create such a list
  • Next by Date: HoldAll/HoldRest
  • Previous by thread: Re: How to create such a list
  • Next by thread: Re: How to create such a list