Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Deleting expressions containing a certain head

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126002] Re: Deleting expressions containing a certain head
  • From: A Retey <awnl at gmx-topmail.de>
  • Date: Thu, 12 Apr 2012 02:35:44 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jm50e9$2q0$1@smc.vnet.net>

Am 12.04.2012 00:26, schrieb Brentt:
> Hello, I have a list of expressions, and I am trying to use DeleteCases to
> delete expressions in the list which contain a certain head *anywhere* in
> the expression. Setting the levelspec for DeleteCases to Infinity almost
> works, except I want to delete the entire expression containing the head
> from the list as opposed to just the head itself while leaving the rest of
> the expression in the list.
>
> e.g.
> I want this
> DeleteCases[{2^(Complex[2,3])+3 , 2 ,3x }, Complex[_,_], Infinity ]
>
> to output this
> {2,3x}
> Getting rid of any expression that has a complex number in it.
>
>   How does one go about this?
>


list = {2^(Complex[2, 3]) + 3, 2, 3 x};

Select[list, FreeQ[#, Complex] &]

hth,

albert



  • Prev by Date: Re: Deleting expressions containing a certain head
  • Next by Date: Re: HostMath - Generate and embed math equations or mathematical
  • Previous by thread: Re: Deleting expressions containing a certain head
  • Next by thread: Re: Deleting expressions containing a certain head