Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Match Pairs of Numbers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86936] Re: Match Pairs of Numbers
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Wed, 26 Mar 2008 04:56:48 -0500 (EST)
  • Organization: University of Bergen
  • References: <fsa5bn$aae$1@smc.vnet.net>

Andrew Beveridge wrote:
> Any help would be appreciated.
> 
> I am using Mathematica 5.2 & 6.0
> 
> I am having trouble finding the correct form of Pattern Matching for 
> pairs of Numbers. I do not know whether to use Select, Cases, Pick, 
> etc. I am also unsure how to set the pattern matching argument.
> 
> Assume I have the list
> 
> lst = {{1,1}, {1,2}, {1,3}, {1,4}, {2,2}, {3,1}, {3,2}, {3,3}, {4,1}, {4,4}}
> 
> 
> I would like to match/select pairs that have the same set of numbers 
> only reversed, that is, the selection would find
> 
> {{1,3}, {3,1}, {1,4}, {4,1} }
> 

Intersection[lst, Reverse /@ lst]

Select[%, UnsameQ @@ # &]


  • Prev by Date: Using ShowLegend with MultipleListPlot
  • Next by Date: Re: Tagged list processing
  • Previous by thread: Re: Match Pairs of Numbers
  • Next by thread: Re: Match Pairs of Numbers