MathGroup Archive 2003

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

Search the Archive

Re: simple vactor magitude question


p = Table[Random[], {10}];



can be written as

MapIndexed[#1*(First[#2] - 1) &, p]


Nathan Moore 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

  • Prev by Date: Newbie: plot data from a text file?
  • Next by Date: Re: Bug 3! Gaussian integration in 5.0 is broken!
  • Previous by thread: Re: simple vactor magitude question
  • Next by thread: poisson equation