Re: what's wrong?!!

*To*: mathgroup at smc.vnet.net*Subject*: [mg115835] Re: what's wrong?!!*From*: Peter Pein <petsie at dordos.net>*Date*: Sat, 22 Jan 2011 03:22:01 -0500 (EST)*References*: <ih16b7$jiq$1@smc.vnet.net> <ih3rd0$bga$1@smc.vnet.net> <ihbjk9$d9n$1@smc.vnet.net>

On 21.01.2011 10:28, olfa wrote: > > 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?! > Hi, A and B are heads of expressions and therefore match _A|_B In[1]:= Cases[ A[l1] == A[l2] && i + B[l2] == iP + B[l1], _A | _B, {0, Infinity}] Out[1]= {A[l1], A[l2], B[l2], B[l1]} if you want the heads only append "[[All, 0]]" to the above line to get In[2]:= %[[All, 0]] Out[2]= {A, A, B, B} Cheers, Peter