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: [mg43787] RE: [mg43754] simple vactor magitude question
  • From: "David Park" <djmp at>
  • Date: Sat, 4 Oct 2003 02:05:06 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


I'm not certain that I completely understand your question.

Here I take a simple vector and set p[i] values from it.

vector = {a, b, c, d};
Do[Set[p[i - 1], Part[vector, i]], {i, 1, 4}]

Checking it...

vec = Table[p[i], {i, 0, 3}]
{a, b, c, d}

Now using your expression...

Sum[p[i]*i, {i, 0, 3}]
b + 2 c + 3 d

it seems to work all right, but it is not the conventional magnitude of the
vector. This could have been done more easily with

vec.Range[0, 3]

If you really want the magnitude you should use...

Sqrt[vec . vec]
Sqrt[a^2 + b^2 + c^2 + d^2]

David Park
djmp at

From: Nathan Moore [mailto:nmoore at]
To: mathgroup 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,


but this doesn't seem to be the correct syntax - any help would be

Nathan Moore,
University of Minnesota Physics

  • Prev by Date: Re: Bug 3! Gaussian integration in 5.0 is broken!
  • Next by Date: Re: Positive Integer Assumptions
  • Previous by thread: Re: simple vactor magitude question
  • Next by thread: Re: simple vactor magitude question