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: computing cumulative sum for list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54405] Re: [mg54367] computing cumulative sum for list
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sun, 20 Feb 2005 00:08:06 -0500 (EST)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

A={a1,a2,a3,a4,a5};

FoldList[Plus, First[A], Rest[A]]

{a1,a1+a2,a1+a2+a3,a1+a2+a3+a4,a1+a2+a3+a4+a5}


Bob Hanlon

> 
> From: Uwe Ziegenhagen <newsgroup at ziegenhagen.info>
To: mathgroup at smc.vnet.net
> Date: 2005/02/19 Sat AM 02:32:18 EST
> To: mathgroup at smc.vnet.net
> Subject: [mg54405] [mg54367] computing cumulative sum for list
> 
> Hello,
> 
> I would like to compute the cumulative sum for a list, but do not find 
> the command.
> 
> For
> 
> {1,2,3,4,5}
> 
> I would like to get
> 
> {1,3,4,10,15}
> 
> 
> Is there nothing builtin in Mathematica? I already looked in lists and 
> matrices and Google...
> 
> Uwe
> 
> -- 
> 
> mail to newsgroup at ziegenhagen.info is read only from time to time. If 
> you need an urgent answer, google for me.
> 
> 


  • Prev by Date: Re: How do I get a DSolve'd function
  • Next by Date: Re: Re: Why does Inverse[M] hesitate?
  • Previous by thread: RE: computing cumulative sum for list
  • Next by thread: Re: computing cumulative sum for list