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 1998

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

Search the Archive

Summing over like elements

  • To: mathgroup at
  • Subject: [mg13855] Summing over like elements
  • From: "Mitchell Kaplan" <qmak at>
  • Date: Mon, 31 Aug 1998 01:09:16 -0400
  • Organization: MindSpring Enterprises
  • Sender: owner-wri-mathgroup at

I have a 2 column array.  Column 1 has some values, many of which are
repeated.  Column 2 has probabilities of these values.

I would like to sum the probabilities for each unique element in column
1. For example:

{{1, .5} , {2, .2} , {1, .1}}  should give me:

{{1, .6} , {2, .2}}

I'm sure I can do this with a "Do" loop -- however it seems that in
general "Do's" are pretty innefficient.

Does anyone have any suggestions?


  • Prev by Date: Re: Re: Defining differential operators question
  • Next by Date: Re: Disappearing variables
  • Previous by thread: UNEXPECTED END OF FILE !!!!!!