MathGroup Archive 2003

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

Search the Archive

Re: sum with lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40631] Re: sum with lists
  • From: Bill Rowe <listuser at earthlink.net>
  • Date: Fri, 11 Apr 2003 02:04:57 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 4/10/03 at 3:43 AM, listuser at earthlink.net (Bill Rowe) wrote:

>On 4/9/03 at 8:26 PM, nmoore at physics.umn.edu (Nathan Moore) wrote:
>
>>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}]
>
>A simple way to do this would be
>
>Tr[Take[d, Floor[n/2].{1,0,1}]

As Dr Bob pointed out to me in another email this definitely does not work.

An approach that does work is

Tr[Times@@@Take[d, Floor[Length[d]/2][[All,{1,3}]]]


  • Prev by Date: Re: comments
  • Next by Date: thanks for the help with list - extended syntax question
  • Previous by thread: Re: sum with lists
  • Next by thread: RE: sum with lists