Re: what's wrong?!!
- To: mathgroup at smc.vnet.net
- Subject: [mg115694] Re: what's wrong?!!
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Tue, 18 Jan 2011 05:52:39 -0500 (EST)
- References: <ih16b7$jiq$1@smc.vnet.net>
The problem lies in the level specification. In the second example you try to match something that is at the top level of the expression. By default level expressions start at 1, but here you need to start at 0. The first expression is And[Equal[...],Equal[...]], but in the second expression you have Equal[...], but Mathematica tries to match with the ... part (level 1 and deeper). The following works: In[236]:= Cases[yP == y + x - z, yP == _, {0, Infinity}] Out[236]= {yP == x + y - z} Cheers -- Sjoerd On Jan 17, 11:40 am, olfa <olfa.mra... 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 == _, I= nfinity] > 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.