MathGroup Archive 2006

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

Search the Archive

Re: List Operations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65688] Re: List Operations
  • From: bghiggins at ucdavis.edu
  • Date: Sun, 16 Apr 2006 01:44:45 -0400 (EDT)
  • References: <e1nn6s$lmm$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Try this:

mylist = {{1, a, b1, c1}, {1, a, b2, c2, c3}, {1, a,
b3, c4}, {2, b, z1}, {2, b, z2, c3}, {2, b, z3, c4, c5}, {2, b, z4},
{3,
     x, y1, c1, c5}, {3, x, y2, c3, c2}, {3, x, y3, c1}, {3,
     x, y4, c3, c1, c2}}

I have made the sublists of different length

Map[{#, Apply[Plus, Cases[mylist, {#, x_, y_, ___} -> x y]]} &, {1, 2,
3}]

{{1, a b1 + a b2 + a b3}, {2, b z1 + b z2 + b z3 +b z4}, {3, x y1 + x
y2 + x y3 + x y4}}

Hope this helps,

Cheers,

Brian


  • Prev by Date: Re: ViewPoint selector
  • Next by Date: Re: List Operations
  • Previous by thread: Re: List Operations
  • Next by thread: Re: List Operations