MathGroup Archive 2011

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

Search the Archive

Re: Select from Tuplet using logical expression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116849] Re: Select from Tuplet using logical expression
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Wed, 2 Mar 2011 04:35:13 -0500 (EST)
  • References: <ikihne$7sk$1@smc.vnet.net>

On Mar 1, 2:27 am, Lengyel Tamas <lt... at hszk.bme.hu> wrote:
> Hello.
>
> Skip if needed:
> ///I am working on a part combinatorical problem with sets of 3
> differently indexed values (e.g. F_i, F_j, F_k, F denoting frequency
> channels) which are subsets of many values (e.g 16 different frequency
> channels, denoted F_0, F_1 ... F_15).
>
> Now, I need to select triplets from these channels, I used Tuplets. So far
> so good. From these I need those combinations where indexes i!=k and/or
> j!=k, and i=j is allowed (e.g {i,j,k} = {12, 12, 4} is a valid channel
> combination, but {3, 12, 3} is not).///
>
> So basically I need to generate triplets from a range of integer numbers,
> where the first and second elements of these triplets do not match the
> third. I thought Select would help, but I don't know if there exists an
> option to control elements' values in a condition.
>
> From then on I must use these triplets' elements in a function.
>
> But first I am asking your help in generating thos triplets of numbers.
>
> Thanks.
>
> Tam s Lengyel

This generates all 16^3 triples, then deletes those you don't want:

Select[Tuples[Range[0,15],3], #[[1]] != #[[3]] && #[[2]] != #[[3]]&]

This generates only the triples you want:

Flatten[Function[ij, Append[ij,#]& /@ Complement[Range[0,15],ij]] /@
 Tuples[Range[0,15],2], 1]


  • Prev by Date: Re: Filtering data from numerical minimization
  • Next by Date: Re: Select from Tuplet using logical expression
  • Previous by thread: Select from Tuplet using logical expression
  • Next by thread: Re: Select from Tuplet using logical expression