Student Support Forum: 'Select' topicStudent Support Forum > General > "Select"

 Next Comment > Help | Reply To Topic
 Author Comment/Response Sinval 11/08/12 1:10pm GRUP = {{1,2,3,4,5,6},{1,2,3,4,5,7}, {1,2,3,4,5,8}, {1,2,3,4,6,7},{1,2,3,4,6,8},{1,2,3,4,7,8},{1,2,3,5,6,7},{1,2,3,5,6,8},{1,2,3,5,7,8},{1,2,3,6,7,8},{1,2,4,5,6,7}, {1,2,4,5,6,8},{1,2,4,5,7,8},{1,2,4,6,7,8},{1,2,5,6,7,8},{1,3,4,5,6,7},{1,3,4,5,6,8}, {1,3,4,5,7,8},{1,3,4,6,7,8},{1,3,5,6,7,8},{1, 4,5,6,7,8},{2,3,4,5,6,7},{2,3,4,5,6,8},{2,3,4,5,7,8},{2,3,4,6,7,8},{2,3,5,6,7,8},{2,4,5,6,7,8},{3,4,5,6,7,8}}; The sample AMS = {2,3,4,5,7,8}; SR represents all combinations of five elements, taken from AMS SR = {{2,3,4,5,7},{2,3,4,5,8},{2,3,4,7,8},{2,3,5,7,8},{2,4,5,7,8},{3,4,5,7,8}}; TA represents the complements of subsets of SR with respect to AMS TA = Table[Complement[AMS,SR[[i]]],{i,Lengt[SR]}] {{8},{7},{5},{4},{3},{2}} I want to select in GRUP, all subsets contained in SR, but without their respective complement contained in TA. Below I made a procedure that works. IS THERE AN EASIER WAY TO SELECT THESE SUBSETS? Thank you Table[Cases[GRUP,x_/;And[Sequence@@({Map[!FreeQ[x,#]&,SR[[i]]],Map[FreeQ[x,#]&,TA[[i]]]}//Flatten)// Evaluate]],{i,Lengt[SR]}]// Flatten[#,1] & {{1,2,3,4,5,7},{2,3,4,5,6,7},{1,2,3,4,5,8},{2,3,4,5,6,8},{1,2,3,4,7,8},{2,3,4,6,7,8},{1,2,3,5,7 8},{2,3,5,6,7,8},{1,2,4,5,7,8},{2,4,5,6,7,8},{1,3,4,5,7,8},{3,4,5,6,7,8}} URL: ,

 Subject (listing for 'Select') Author Date Posted Select Sinval 11/08/12 1:10pm Re: Select Peter Pein 11/10/12 10:46am
 Next Comment > Help | Reply To Topic