Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

Re: List-Operations on Heads other than List

  • To: mathgroup at
  • Subject: [mg29739] Re: List-Operations on Heads other than List
  • From: "Allan Hayes" <hay at>
  • Date: Fri, 6 Jul 2001 03:24:34 -0400 (EDT)
  • References: <9i068k$h0i$>
  • Sender: owner-wri-mathgroup at

"Detlef Mueller" <dmueller at> wrote in message
news:9i068k$h0i$1 at
> Hello,
> The Help Browser says:
> Select[list, crit] picks out all elements ...
> Now this works fin for other Haeders thal List
> too.
> Select[Expand[P], ! NumberQ[#] &] removes the
> absolute Part of the Poynomial P
> (in my Version).
> Is this a dangerous Way of Programming?
> Greetings
>   Detlef

This is fine as long as
1) the expanded polynomial has more than one term
2) the absolute part is a number.

Re 1)
    x+3 has full form Plus[x,3] and so is the same shape as  {x,3} (which
has full form List[x,3]
But x and 3 are not of this form.

Re 2)  If the polynomial is in the variables x we could use
        Select[Expand[P], ! FreeQ[#,x] &]
 but we still run into the problem 1); and we have to use  Alternatives[x,y,
...] in place of x for a polynomial in variables x,y, ...

One way out of both 1) and 2) is .

Select[Expand[P]+Unique[], ! FreeQ[#, Alternatives[x,y...]] &]

Another way is

        (# - #/. {x->0,y->0, ...})&P

For dealing with many variables note that

    Thread[{x,y,...}->0]  gives {x->0, y->0, ...}

Allan Hayes
Mathematica Training and Consulting
Leicester UK
hay at
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

  • Prev by Date: Re: Should Pure Functions Require &
  • Next by Date: Re: proof by induction?
  • Previous by thread: Re: List-Operations on Heads other than List
  • Next by thread: Re: List-Operations on Heads other than List