Re: Need to reduce 2 lists so that only {x,y} pairs with same x remain

• To: mathgroup at smc.vnet.net
• Subject: [mg24180] Re: [mg24134] Need to reduce 2 lists so that only {x,y} pairs with same x remain
• From: BobHanlon at aol.com
• Date: Wed, 28 Jun 2000 22:51:00 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```In a message dated 6/28/2000 2:39:53 AM, materialsscientist at my-deja.com
writes:

>I have 2 lists of data:
>
>for example
>data1={{1,1},{1.5,1.5},{2,2},{3,3},{4,4},{5,5}}
>
>data2={{1,2},{2,3},{3,4},{4,5},{6,7},{7,8}}
>
>
>I want to do a point by point comparision, so I
>need to reduce both data1 and data2 so that
>common x data in the {x,y} pairs for each list
>remain.
>
>Thus the lists should look like this:
>
>data1={{1,1},{2,2},{3,3},{4,4}}
>data2={{1,2},{2,3},{3,4},{4,5}}
>
>What function(s) would to something like this?
>

data1 = {{1, 1}, {1.5, 1.5}, {2, 2}, {3, 3}, {4, 4}, {5, 5}};

data2 = {{1, 2}, {2, 3}, {3, 4}, {4, 5}, {6, 7}, {7, 8}};

data1 = Select[data1, MemberQ[First[Transpose[data2]], #[[1]]] &]

{{1, 1}, {2, 2}, {3, 3}, {4, 4}}

data2 = Select[data2, MemberQ[First[Transpose[data1]], #[[1]]] &]

{{1, 2}, {2, 3}, {3, 4}, {4, 5}}

Bob Hanlon

```

• Prev by Date: Meijer G Function
• Next by Date: Re: Integration...
• Previous by thread: Re: Need to reduce 2 lists so that only {x,y} pairs with same x remain
• Next by thread: Re: Need to reduce 2 lists so that only {x,y} pairs with same x remain