Re: simple vactor magitude question
- To: mathgroup at smc.vnet.net
- Subject: [mg43785] Re: simple vactor magitude question
- From: "Mark Westwood [EPCC]" <markw at epcc.ed.ac.uk>
- Date: Sat, 4 Oct 2003 02:05:03 -0400 (EDT)
- Organization: Edinburgh University
- References: <blj5e0$1dv$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Nathan,
If you have stored p as a list, that is a sequence of values enclosed by
{ and }, then the correct syntax for selecting the i-th value is p[[i]]
- with doubled square brackets.
Regards
Mark Westwood
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
>