MathGroup Archive 2009

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

Search the Archive

Re: find subsets

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104752] Re: [mg104694] find subsets
  • From: Tomas Garza <tgarza10 at msn.com>
  • Date: Sun, 8 Nov 2009 06:50:41 -0500 (EST)
  • References: <200911071147.GAA09918@smc.vnet.net>

Try

In[2]:= Select[Ns,MemberQ[#,b]&&MemberQ[#,c]&]

Out[2]= {{a,b,c},{b,c,d},{b,c,e}}

Tomas

> Date: Sat, 7 Nov 2009 06:47:11 -0500
> From: radford.schantz at mms.gov
> Subject: [mg104694] find subsets
> To: mathgroup at smc.vnet.net
>
> Hello,
> here is a quick question from a novice.
>
> First, generate a list of subsets using Subsets or KSubsets
> functions.
>
> Ns = KSubsets[{a,b,c,d,e},3] = {{a,b,c},{a,b,d},{a,b,e},{a,c,d}, etc.}
>
> How can one infer from that list a list of its members that contain
> given elements, e.g. a list of members that contain b, or those that
> contain both b and c? For illustration:
>
> Some_function[Ns, b and c] = { {a,b,c},{b,c,d},{b,c,e}}
>
> I keep thinking there must be a direct way to do this using Select or
> some other function?
>


  • References:
  • Prev by Date: Re: find subsets
  • Next by Date: Re: How can I reduce the frequency of a sine wave tia sal22
  • Previous by thread: find subsets
  • Next by thread: Re: find subsets