RE: simple vactor magitude question
- To: mathgroup at smc.vnet.net
 - Subject: [mg43787] RE: [mg43754] simple vactor magitude question
 - From: "David Park" <djmp at earthlink.net>
 - Date: Sat, 4 Oct 2003 02:05:06 -0400 (EDT)
 - Sender: owner-wri-mathgroup at wolfram.com
 
Nathan,
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 earthlink.net
http://home.earthlink.net/~djmp/
From: Nathan Moore [mailto:nmoore at physics.umn.edu]
To: mathgroup at smc.vnet.net
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