Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*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

Sum elements in a list with conditions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69828] Sum elements in a list with conditions
  • From: "Guillermo Sanchez" <guillermo.sanchez at hotmail.com>
  • Date: Sat, 23 Sep 2006 23:45:50 -0400 (EDT)

Dear group
I have a pair of elements list. The second elements of the list should
be summed when the first element of the pairs are equals. Example

Given

{{a1, b1},{a2,b2},{a2,b3},{a2,b4},{a3, b5}, {a3, b6}}

the output should be

{{a1, b1},{a2, b2+b3+b4},{a3, b5+b6}}

Thanks 

Guillermo


  • Prev by Date: showing your work in mathematica
  • Next by Date: Re: cusp fold surface
  • Previous by thread: Re: showing your work in mathematica
  • Next by thread: Re: Sum elements in a list with conditions