Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

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

Search the Archive

Re: simple vactor magitude question

  • To: mathgroup at
  • Subject: [mg43771] Re: simple vactor magitude question
  • From: "John Jowett" <John.Jowett at>
  • Date: Sat, 4 Oct 2003 02:04:51 -0400 (EDT)
  • Organization: CERN
  • References: <blj5e0$1dv$>
  • Sender: owner-wri-mathgroup at

Assuming p is a simple list, something like
then the list index should start at zero (unlike the C programming

In Mathematica, there is usually no need to loop over an index with the
advantage that this kind of error can be avoided.  Other ways to get your
result might be




The latter method readily generalises to more complicated examples.

John Jowett

"Nathan Moore" <nmoore at> wrote in message
news:blj5e0$1dv$1 at
> 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
> 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: Re: Automatic execution of a notebook
  • Next by Date: Re: Bug 3! Gaussian integration in 5.0 is broken!
  • Previous by thread: Re: simple vactor magitude question
  • Next by thread: RE: simple vactor magitude question