MathGroup Archive 2005

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

Search the Archive

Re: computing cumulative sum for list


{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