RE: computing cumulative sum for list

*To*: mathgroup at smc.vnet.net*Subject*: [mg54434] RE: [mg54367] computing cumulative sum for list*From*: "David Park" <djmp at earthlink.net>*Date*: Sun, 20 Feb 2005 00:10:02 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Uwe, You're going to get a lot of answers to this. FoldList[Plus, 0, {1, 2, 3, 4, 5}] {0, 1, 3, 6, 10, 15} If you don't want the leading zero... Drop[FoldList[Plus, 0, {1, 2, 3, 4, 5}], 1] {1, 3, 6, 10, 15} David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Uwe Ziegenhagen [mailto:newsgroup at ziegenhagen.info] To: mathgroup at smc.vnet.net 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.