MathGroup Archive 2003

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

Search the Archive

Re: Matrices Over Z/NZ

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39049] Re: [mg39043] Matrices Over Z/NZ
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Sun, 26 Jan 2003 05:22:41 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On Saturday, January 25, 2003, at 03:32 PM, flip wrote:

> Hello,
>
> If I want to create a matrix A mod 2,  which is a matrix of 0's and 
> 1's, how
> do I do that?

For example:

In[27]:=
Array[Random[Integer]&,{3,3}]

Out[27]=
{{0,1,0},{1,0,0},{1,0,1}}

>
> So, if I want all 2x2 matrices, A mod 2, there would be 2^4 = 16 such
> matrices consisting only of 0's and 1's.
>
> These will be:
>
> {{{0, 0}, {0, 0}}, {{1, 0}, {0, 0}}, ..., {{1, 1}, {1, 1}}}
>
> I looked at permutations, discrete and combinatoria, but didn't see 
> anything
> obvoius (but I just missed it probably).

In[28]:=
Partition[#,2]&/@Distribute[Table[{0,1},{4}],List]

Out[28]=
{{{0,0},{0,0}},{{0,0},{0,1}},{{0,0},{1,0}},{{0,0},{1,1}},{{0,1},{
       0,0}},{{0,1},{0,1}},{{0,1},{1,0}},{{0,1},{1,1}},{{1,0},{
       0,0}},{{1,0},{0,1}},{{1,0},{1,0}},{{1,0},{1,1}},{{1,1},{
       0,0}},{{1,1},{0,1}},{{1,1},{1,0}},{{1,1},{1,1}}}

>
> Laslty, I'd like to be to do any size matrix (that is, 2x2, 3x3, where 
> it is
> user selectable) and any mod n.

"Any size" is obviously a pipe dream because of memory limitations. 
However, here is the same thing with 3 by 3 matrices mod 3.

Partition[#, 3] & /@ Distribute[Table[Range[0, 2], {3^2}], List]

This has 19683 elements, each a 3 x 3 matrix, in all a list of 177147 
elements. With normal amounts of RAM can compute a one or two larger 
cases, but displaying probably be a problem.


Andrzej Kozlowski
Yokohama, Japan
http://www.mimuw.edu.pl/~akoz/
http://platon.c.u-tokyo.ac.jp/andrzej/



  • Prev by Date: Re: Repetitive sums of divisors
  • Next by Date: Re: Re: Lower Floor
  • Previous by thread: Re: Matrices Over Z/NZ
  • Next by thread: Repetitive sums of divisors