MathGroup Archive 2003

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

Search the Archive

Re: ack! simple partitioning problem making my head swim....

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42073] Re: ack! simple partitioning problem making my head swim....
  • From: "Will Self" <wself at msubillings.edu>
  • Date: Wed, 18 Jun 2003 02:10:44 -0400 (EDT)
  • References: <bcmpjg$sq8$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"cdj" <a_cjones at hotmail.com> wrote in message
news:bcmpjg$sq8$1 at smc.vnet.net...
> Hi all,
>
> I'm given 2 (ordered) lists - list1 has elements a_1,..a_n, and list2
> has elements b_1,...,b_n.
>
> As efficiently as possible, I want to determine whether or not these
> lists represent matrices that can be multiplied together. In list
> format, I'm imagining that "a list represents a matrix" means simply:
> the 1st row of the matrix are the first list entries, the second row
> comes next, and so on (just as in the Mathematica command
> Flatten[{{1,2},{3,4}}] = {1,2,3,4}.
>
> (a) It's clear enough that finding a solution to this problem is gonna
> involve comparing the factors in the lengths of the two lists, but
> then it all goes wishywashy in my head. lil help?
>
> (b) Assume there does exist a way of partitioning the two input lists
> so that they form "multiplicatively-friendly" matrices. Is this
> guaranteed to be unique? Or is it possible that there be *several*
> ways to partition given lists into m-friendly matrices?
>
> thanks a bunch for any insights,
>
> cdj

For each factor of p of n, you can create two matrices that can be
multiplied.  If n=pq, then you can partition the first matrix into
a p by q matrix and the second one into a q by p matrix.  Then when
you multiply these, the result will be a p by p matrix.  The
command you want for partitioning the matrices is (surprise)
Partition.  You will want to partition the first list into sublists
of length q, and the second list into sublists of length p.

Not to forget the extreme case, p=1.  In that case, your first
matrix becomes {{a1, a2, ..., an}}  (that's a matrix with only one
row) and your second matrix becomes {{b1}, {b2}, ... ,{bn}}
(that's a matrix with only one column, and when you multiply these
two you get {{a1 b1 + a2 b2 + ... + an bn}}, which is a 1 by 1
matrix with only one entry.

Don't forget that to multiply two matrices in Mathematica you have
to put a dot (period) between them.  You write aa.bb, not aa*bb
or aa bb.
The other extreme case is p=n, and that is interesting too.



  • Prev by Date: Re: symbols to separate characters in a variable
  • Next by Date: Mathematica courses in Amsterdam - one of the most beautiful cities in Europe
  • Previous by thread: Re: ack! simple partitioning problem making my head swim....
  • Next by thread: Re: ack! simple partitioning problem making my head swim....