MathGroup Archive 2003

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

Search the Archive

Re: sum with lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40555] Re: sum with lists
  • From: bobhanlon at aol.com (Bob Hanlon)
  • Date: Thu, 10 Apr 2003 03:36:53 -0400 (EDT)
  • References: <b70npo$9gd$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

n=20;

d = Table[ks=ToString[k];
      ToExpression["{x"<>ks<>
          ",y"<>ks<>",z"<>ks<>"}"],
      {k,0,n}];

Tr[First[#]*Last[#]& /@ Take[d,n/2+1]]

or


(First /@ #).(Last /@ #)&[Take[d,n/2+1]]


Bob Hanlon

In article <b70npo$9gd$1 at smc.vnet.net>, "Nathan Moore" <nmoore at physics.umn.edu>
wrote:

<< 
Subject:	sum with lists
From:		"Nathan Moore" <nmoore at physics.umn.edu>
To: mathgroup at smc.vnet.net
Date:		Wed, 9 Apr 2003 09:06:00 +0000 (UTC)

Another list question.  Suppose that I have the list 
    d={
    {x0,y0,z0},
    {x1,y1,z1},
    {x2,y2,z1},
    ...
    {xn,yn,zn}}

and now I'd like to calculate the sum, 
    Sum[x[i]*z[i],{i,0,n/2}]

I tried 
    Sum[d[[i, 1]]*d[[i, 3]], {i, 0, 10}]
with little success

thanks,

Nathan Moore,
University of Minnesota Physics












 >><BR><BR>


  • Prev by Date: Re: sum with lists
  • Next by Date: Re: arrows at both ends of a line?
  • Previous by thread: Re: sum with lists
  • Next by thread: Strange behavior with Nonlinear regress