MathGroup Archive 2010

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

Search the Archive

Generalizing Complement to handle multiple occurrences of elements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112425] Generalizing Complement to handle multiple occurrences of elements
  • From: Mark Coleman <markspcoleman at gmail.com>
  • Date: Wed, 15 Sep 2010 04:38:25 -0400 (EDT)

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: get a table of coordinates from an image of a graph
  • Next by Date: Re: How to rescale the x-axis in an nonlinear way?
  • Previous by thread: Re: get a table of coordinates from an image of a graph
  • Next by thread: Re: Generalizing Complement to handle multiple occurrences