Re:Help please: Summing a list
- To: mathgroup at smc.vnet.net
- Subject: [mg13515] Re:[mg13480] Help please: Summing a list
- From: Tomas Gargz <tgarza at mail.internet.com.mx>
- Date: Fri, 31 Jul 1998 04:33:29 -0400
- Sender: owner-wri-mathgroup at wolfram.com
robpeterson at iname.com wrote:
>I make a list of numbers, eg:
>P=Table[6,{x,0,110}]; (I have a more interesting list to use later if I
>get this working)
>Now I want to make another list PP in which each entry PP[[i]] is the
>sum of P's first i entries. I try
>PP[[i]]:=Sum[P[[n]],{n,0,i}];
Rob:
Try FoldList[Plus, 0, P]
Alternatively, the Standard AddOn Statistics DataManipulation has a
function CumulativeSums.
Good luck
Tomas Garza
Mexico City