Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Cases' topicStudent Support Forum > General > "Cases"

Next Comment >Help | Reply To Topic
Author Comment/Response
Sinval Santos
10/29/12 08:12am

ss = {{H[1], M[1], M[2]}, {H[2], H[1], M[2]}, {M[1], H[1], H[2]}, {H[2], M[2],
M[1]}};

It does not work.

In[1]:= Cases[ss, u_ /; (u[[1]] == H[_]) && (u[[2]] == M[_])]

Out[1]= {}

It only works with this form.

In[2]:= Cases[ss, u_ /; (u[[1]] == H[1] || u[[1]] == H[2]) && (u[[2]] == M[1] ||
u[[2]] == M[2])]

Out[2]= {{H[1], M[1], M[2]}, {H[2], M[2], M[1]}}

How do?

URL: ,

Subject (listing for 'Cases')
Author Date Posted
Cases Sinval Santos 10/29/12 08:12am
Re: Cases Bill Simpson 10/29/12 12:25pm
Next Comment >Help | Reply To Topic