MathGroup Archive 2011

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

Search the Archive

Re: what's wrong?!!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115671] Re: what's wrong?!!
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 18 Jan 2011 05:48:10 -0500 (EST)

Cases looks at the parts of the expression. In your first example the equalities were parts of the expression. In your second example the the equality is the expression and Cases looks at its parts. The easiest solution is to put the equality inside a list so that it becomes a part for Cases to check against the pattern.

Cases[{yP == y + x - z}, yP == _, Infinity]

{yP == x + y - z}

or add a dummy part

Cases[yP == y + x - z && a > b, yP == _, Infinity]

{yP == x + y - z}


Bob Hanlon

---- olfa <olfa.mraihi at yahoo.fr> wrote: 

=============
Hi Mathematica community,

I try to use Case[exp,patt,Infinity]

for the first example it works:
Cases[iP == i + v && kaP == 3^v,  iP == _ | kaP == _, Infinity]
the output is  {iP == i + v, kaP == 3^v}

but not for the second one!!
 Cases[yP == y + x - z, yP == _, Infinity]
the output is  {}

why?!!

Thank you.



  • Prev by Date: Re: what's wrong?!!
  • Next by Date: Re: what's wrong?!!
  • Previous by thread: Re: what's wrong?!!
  • Next by thread: Re: what's wrong?!!