Re: How to make a loop for this problem!

• To: mathgroup at smc.vnet.net
• Subject: [mg75397] Re: How to make a loop for this problem!
• From: Roger Bagula <rlbagula at sbcglobal.net>
• Date: Sat, 28 Apr 2007 05:56:57 -0400 (EDT)
• References: <f0pkt5\$28h\$1@smc.vnet.net> <f0sf6s\$n2u\$1@smc.vnet.net>

```Peter Pein wrote:

>
>
>
>Hi,
>
>there are only 512 distinct 3x3 matrices with elements out of the set {0,1}.
>Therefore you can shuffle the list {0,1,2,...,511} and convert each number n
>of this list into a matrix. To do this, convert n into binary representation
>with leading zeroes and partition this list of 9 digits into three parts:
>
>In[1]:=
><< "DiscreteMath`Combinatorica`"
>mats = (Partition[IntegerDigits[#1, 2, 9], 3] & ) /@
>   RandomPermutation[Range[0, 511]];
>
>the first two matrices:
>
>In[3]:= Take[mats, 2]
>Out[3]=
>{{{1, 1, 0},
>  {0, 1, 1},
>  {1, 1, 0}},
> {{1, 1, 0},
>  {0, 1, 0},
>  {1, 0, 0}}}
>
>To check for duplicates (impossible):
>In[4]:= Sort[mats] === Union[mats]
>Out[4]= True
>
>I had to sort "mats" because Union gives a sorted output.
>
>
>HTH,
>Peter
>
>
>
Peter,
Nice function!
Looking at the determinants of the matrices you get a distribution!
Try:
<< "DiscreteMath`Combinatorica`"
mats = (Partition[IntegerDigits[#1, 2, 9], 3] & ) /@
RandomPermutation[Range[0, 511]];
a = Take[mats, 512];
Dimensions[a]
b = Table[Det[a[[n]]], {n, 1, 512}]
ListPlot[b]
c = Table[Count[b, n], {n, Min[b], Max[b]}]
ListPlot[c, PlotJoined -> True, PlotRange -> All]

Roger Bagula

```

• Prev by Date: Fourier and InverseFourier
• Next by Date: Re: FourierTransform and removable singularities
• Previous by thread: Re: How to make a loop for this problem!
• Next by thread: Re: How to make a loop for this problem!