The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Average the same elements of the list
Replies: 4   Last Post: May 24, 2013 5:24 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Tomas Garza Hernandez

Posts: 264
Registered: 4/15/05
Re: Average the same elements of the list
Posted: May 23, 2013 3:55 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Elegance is often a matter of individual taste (it lies in the eyes of the
beholder?), but a possible way is
> From:
> Subject: Average the same elements of the list
> To:
> Date: Wed, 22 May 2013 02:18:09 -0400
> Hello,
> I have list which is something like
> data={
> {{a1,b1,c1},d1},{{a2,b2,c2},d2}}
> I would like to get new list which gets average of the second elements if the first elements in the sublists are all the same.
> Namely if a1=a2,b1=b2,c1=c2
> new list would look like
> datanew={{a1,b1,c1},Mean[{d1,d2}]
> Is there an elegant way to do this ?
> Thanks!

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.