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 2006

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

Search the Archive

Re: List Operations

  • To: mathgroup at
  • Subject: [mg65702] Re: List Operations
  • From: "Ray Koopman" <koopman at>
  • Date: Sun, 16 Apr 2006 01:45:10 -0400 (EDT)
  • References: <e1nn6s$lmm$>
  • Sender: owner-wri-mathgroup at

LectorZ wrote:
> Hi guys,
> My question:
> mylist={{1,a, b},{1,a, b},{1,a,
> b},{2,b,z},{2,b,z},{2,b,z},{2,b,z},....,{n,x,y},{n,x,y},{n,x,y},...{n,x,y}}
> The sublists are of different length.
> I need to calculate the product between the 2nd and 3rd element of
> every sublist (e.g. a*b) and then add them up according to the 1st
> element: sum of all products where the 1st element is 1, 2, ...n.
> The result should be a list like that:
> {{1,a*b+a*b+a*b},{2,b*z+b*z+b*z+b*z}, ...,{n, x*y+x*y+x*y+...+x*y}}
> Thank you for your help.
> LZ

In[1]:= mylist= {{1,a1,b1},{1,a2,b2},{1,a3,b3},

In[2]:= {#[[1,1]],#[[All,2]].#[[All,3]]}& /@

Out[2]= {{1,a1*b1+a2*b2+a3*b3},

  • Prev by Date: Re: bug in Partition?
  • Next by Date: Fitting a complex Function with FindMinimum
  • Previous by thread: Re: List Operations
  • Next by thread: Re: List Operations