Re: simple vactor magitude question

*To*: mathgroup at smc.vnet.net*Subject*: [mg43773] Re: simple vactor magitude question*From*: bobhanlon at aol.com (Bob Hanlon)*Date*: Sat, 4 Oct 2003 02:04:52 -0400 (EDT)*References*: <blj5e0$1dv$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

n = 5; p = Table[Random[], {n+1}]; Sum[p[[i+1]]*i, {i,0,n}] 6.32604 p.Range[0,Length[p]-1] 6.32604 i=0; Fold[(#1+#2*i++)&, 0, p] 6.32604 Bob Hanlon In article <blj5e0$1dv$1 at smc.vnet.net>, Nathan Moore <nmoore at physics.umn.edu> wrote: << Suppose I generate a 1-d vecctor of "N" numbers, p[i], and now I want to find the sum of (the vector element * index). I think the syntax should look something like, Sum[p[i]*i,{i,0,N}] but this doesn't seem to be the correct syntax - any help would be appreciated.