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: [mg54451] Re: [mg54367] computing cumulative sum for list
  • From: DrBob <drbob at bigfoot.com>
  • Date: Sun, 20 Feb 2005 00:11:03 -0500 (EST)
  • References: <200502190732.CAA06098@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

{1,2,3,4,5}
Rest@FoldList[Plus,0,%]

{1,2,3,4,5}

{1,3,6,10,15}

Bobby

On Sat, 19 Feb 2005 02:32:18 -0500 (EST), Uwe Ziegenhagen <newsgroup at ziegenhagen.info> wrote:

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



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: Question about an integral
  • Next by Date: Re: Pattern matching in functions
  • Previous by thread: computing cumulative sum for list
  • Next by thread: Re: computing cumulative sum for list