Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.4K Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

The usage of DuplicateFreeQ

Posted 3 years ago
POSTED BY: Hongyi Zhao
2 Replies
Posted 3 years ago

Nice. It does the trick:

In[12]:= xx=Tuples[{0,1},3]
Select[xx,! #[[1]]==#[[2]]==#[[3]]&]
%==Select[xx, ! SameQ @@ # &]==Select[xx, ! Equal @@ # &]

Out[12]= {{0, 0, 0}, {0, 0, 1}, {0, 1, 0}, {0, 1, 1}, {1, 0, 0}, {1, 
  0, 1}, {1, 1, 0}, {1, 1, 1}}

Out[13]= {{0, 0, 1}, {0, 1, 0}, {0, 1, 1}, {1, 0, 0}, {1, 0, 1}, {1, 
  1, 0}}

Out[14]= True

P.S. It seems that in this case, both SameQ and Equal work.

POSTED BY: Hongyi Zhao
Posted 3 years ago

Why doesn't my usage return any results?

That is because all matrix rows contains duplicates.

SameQ could be used:

Select[x, ! SameQ @@ # &]
POSTED BY: Hans Milton
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard