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

MathGroup Archive 2013

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

Search the Archive

Removing list elements in x by list y

  • To: mathgroup at
  • Subject: [mg131122] Removing list elements in x by list y
  • From: "Dr. Wolfgang Hintze" <weh at>
  • Date: Thu, 13 Jun 2013 02:36:35 -0400 (EDT)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:

I have simple question.

Given two lists

x = {u, v, w, w, d};
y = {u, d};

I wish to "subtract" y from x, i.e. remove exactly the elements in x
which belong to y giving

x "-" y = {v,w,w}

Complement[] gives instead {v,w}.
Note that we are talking about lists rather than sets.

I'm sure there is a simple standard command, but I can't find it.
Can you?


  • Prev by Date: Re: problems with NDSolve
  • Next by Date: Re: System Modeler and Mathematica 9
  • Previous by thread: problem with ndsolve using interpolated functions
  • Next by thread: Re: Removing list elements in x by list y