MathGroup Archive 2011

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

Search the Archive

Re: what's wrong?!!


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


  • Prev by Date: Re: New Mathematica file format .cdf; what is it?
  • Next by Date: Re: New Mathematica file format .cdf; what is it?
  • Previous by thread: Re: what's wrong?!!
  • Next by thread: Re: what's wrong?!!