Re: simple vactor magitude question
- To: mathgroup at smc.vnet.net
- Subject: [mg43784] Re: simple vactor magitude question
- From: "Tom R." <ZZNHTFKGIAIT at spammotel.com>
- Date: Sat, 4 Oct 2003 02:05:02 -0400 (EDT)
- References: <blj5e0$1dv$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
This should do it: Apply[Plus, Table[p[[i]] i, {i, 0, Length[p] - 1}]] Maybe someone has a more elegant solution... Tom On Fri, 3 Oct 2003 06:36:48 +0000 (UTC), 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. > >Nathan Moore, >University of Minnesota Physics