Re: what's wrong?!!
- To: mathgroup at smc.vnet.net
- Subject: [mg115838] Re: what's wrong?!!
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Sat, 22 Jan 2011 03:22:36 -0500 (EST)
Cases[A[l1] == A[l2] && i + B[l2] == iP + B[l1], A | B, {0, Infinity}, Heads -> True] {A, A, B, B} Bobby On Fri, 21 Jan 2011 03:28:37 -0600, olfa <olfa.mraihi at yahoo.fr> wrote: > On 18 jan, 11:52, "Sjoerd C. de Vries" <sjoerd.c.devr... at gmail.com> > wrote: >> 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.- Masquer le texte des messages pr=E9c=E9dents - >> >> - Afficher le texte des messages pr=E9c=E9dents - > > still have problem with Cases for another example: > > Cases[A[l1] == A[l2] && i + B[l2] == iP + B[l1], A | B, {0, Infinity}] > > returns {} why?! > -- DrMajorBob at yahoo.com