Re: How to make a loop for this problem!

• To: mathgroup at smc.vnet.net
• Subject: [mg75371] Re: How to make a loop for this problem!
• From: dh <dh at metrohm.ch>
• Date: Fri, 27 Apr 2007 05:21:51 -0400 (EDT)
• References: <f0pkt5\$28h\$1@smc.vnet.net>

```
Hi,

you want 512 3x3 binary matrices that are all different. Well, this

exhausts just about all such matrices. We can therefore create them in

an orderly way instead of randomly. Now, all 9 bits of one matrix can be

thougth of as a binary number between 0 and 511. We therefore, first

generate the numbers in decimal notation, convert them to 9 binary bits

and assemble them in  3x3 matrices:

d=IntegerDigits[Range[0,511],2,9] ;

d=Partition[#,3]&/@ d ;

this gives an ordered list of all possible such matrices.

hope this helps, Daniel

pskmaths at googlemail.com wrote:

> Hi all,

>

> This comand:

> A = Array[Random[Integer] &, {3, 3}]

> generates a 3x3 random matrix its terms between 0 and 1.

>

> I need to make a loop that geerates a finite number of matrices, let's

> say 512 and this loop check that non of the matrices is equal to

> another one (no repeated matrices)

>

> I can geerate thoses random, matrices with this command:

> Do[Print[Array[Random[Integer] &, {3, 3}]], {512}]

> but I may have two matrices that are equal and also as far as I know I

> cann't use the out put because of the command, Print.

>

>

```

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