MathGroup Archive 2007

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

Search the Archive

Re: Combination List

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78123] Re: Combination List
  • From: Norbert Marxer <marxer at mec.li>
  • Date: Sat, 23 Jun 2007 07:13:19 -0400 (EDT)
  • References: <f55qci$k58$1@smc.vnet.net><f58bk7$6ve$1@smc.vnet.net>

On 22 Jun., 12:38, "Bruno Campanini" <B... at gmail.com> wrote:
> "Sem" <sarner2006-... at yahoo.it> wrote in message
>
> news:f5dj3m$snm$1 at smc.vnet.net...
>
>
>
>
>
> > Did you mean this:
>
> > In[1]:= Tuples[Range[4],3]
> > Out[1]=
> > {{1,1,1},{1,1,2},{1,1,3},{1,1,4},{1,2,1},{1,2,2},{1,2,3},{1,2,4},{1,3,1=
},{1=AD,3,
>
> > 2},{1,3,3},{1,3,4},{1,4,1},{1,4,2},{1,4,3},{1,4,4},{2,1,1},{2,1,2},{2,1,
>
> > 3},{2,1,4},{2,2,1},{2,2,2},{2,2,3},{2,2,4},{2,3,1},{2,3,2},{2,3,3},{2,3,
>
> > 4},{2,4,1},{2,4,2},{2,4,3},{2,4,4},{3,1,1},{3,1,2},{3,1,3},{3,1,4},{3,2,
>
> > 1},{3,2,2},{3,2,3},{3,2,4},{3,3,1},{3,3,2},{3,3,3},{3,3,4},{3,4,1},{3,4,
>
> > 2},{3,4,3},{3,4,4},{4,1,1},{4,1,2},{4,1,3},{4,1,4},{4,2,1},{4,2,2},{4,2,
>
> > 3},{4,2,4},{4,3,1},{4,3,2},{4,3,3},{4,3,4},{4,4,1},{4,4,2},{4,4,3},{4,4,
> >    4}}
>
> > In[2]:= Length[%]
> > Out[2]= 64
>
> Not exactly.
>
> Tuples[Range[3],2]  gives:
> 1 1
> 1 2
> 1 3
> 2 1
> 2 2
> 2 3
> 3 1
> 3 2
> 3 3
>
> I need instead unique values:
> 1 1
> 1 2
> 1 3
> 2 2
> 2 3
> 3 3
>
> Bruno- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

Hello

Then you should (first) map Sort to each sublist and (second) use
Union:

Range[3] // Tuples[#, 2] & // Map[Sort, #] & // Union // ColumnForm

Best Regards
Norbert Marxer



  • Prev by Date: Re: Integrate modified in version 6?
  • Next by Date: Re: Integrate modified in version 6?
  • Previous by thread: Re: Combination List
  • Next by thread: Re: Combination List