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

MathGroup Archive 2010

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

Search the Archive

Re: Generalizing Complement to handle multiple occurrences of elements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112474] Re: Generalizing Complement to handle multiple occurrences of elements
  • From: "Tony Harker" <a.harker at ucl.ac.uk>
  • Date: Thu, 16 Sep 2010 06:02:39 -0400 (EDT)

Sorry, ignore last -- sent in error. 

]-> -----Original Message-----
]-> From: Mark Coleman [mailto:markspcoleman at gmail.com] 
]-> Sent: 15 September 2010 09:38
]-> To: mathgroup at smc.vnet.net
]-> Subject: Generalizing Complement to handle 
]-> multiple occurrences of elements
]-> 
]-> Greetings,
]-> 
]-> I'm wondering how one can efficiently generalize the built-in
]-> Complement function to return multiple occurrences of elements. For
]-> instance, the current version generates
]-> 
]-> a={1,2,2,3,4,4,4,4}
]-> b={3,5,7}
]-> 
]-> Complement[a,b]={1,2,4}
]-> 
]-> I'm looking for a way to define
]-> 
]-> myComplement[a,b]={1,2,2,4,4,4,4}
]-> 
]-> My current code is very inefficient!
]-> 
]-> Thanks,
]-> 
]-> Mark
]-> 
]-> 



  • Prev by Date: Plotting Quartic Solutions in Polar Coordinates
  • Next by Date: Re: Generalizing Complement to handle multiple occurrences of elements
  • Previous by thread: Re: Generalizing Complement to handle multiple occurrences of elements
  • Next by thread: Re: Generalizing Complement to handle multiple occurrences of elements