MathGroup Archive 2000

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

Search the Archive

Working with lists of matrices.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg22747] Working with lists of matrices.
  • From: "Jordan Rosenthal" <jr at ece.gatech.edu>
  • Date: Fri, 24 Mar 2000 03:27:42 -0500 (EST)
  • Organization: Georgia Institute of Technology, Atlanta GA, USA
  • Sender: owner-wri-mathgroup at wolfram.com

Hi all,

Does anybody have any pointers about how to work with lists of matrices.
For example,  I have created the following function:

%--------------------
In[3]:=
reflectionMatrix::usage =
    "reflectionMatrix[theta] creates the matrix to reflect a point in a line
\
oriented at theta radians.";
reflectionMatrix[theta_] := Module[
      {u = {{Cos[theta]}, {Sin[theta]}}},
      IdentityMatrix[2] - 2u.Transpose[u]
      ];
SetAttributes[reflectionMatrix, Listable]
%--------------------

Notice that I set the attributes to Listable so that I can use it like:

%--------------------
In[29]:=
r = reflectionMatrix[2*Pi/{12, 8, 6, 4, 3, 2}]

Out[29]=
{{{-(1/2), -(Sqrt[3]/2)}, {-(Sqrt[3]/2), 1/2}}, {{0, -1}, {-1, 0}},
{{1/2, -(Sqrt[3]/2)}, {-(Sqrt[3]/2), -(1/2)}},
  {{1, 0}, {0, -1}}, {{1/2, Sqrt[3]/2}, {Sqrt[3]/2, -(1/2)}}, {{-1, 0}, {0,
1}}}
%--------------------

Now lets say I want to form a list of the matrices Inverse[V].Ak.V where the
matrices Ak are taken from the above list and V is an arbitrary matrix.  I
tried

   V = {{1,0},{0,1}}
   Inverse[V].r.V

but I get errors about incompatible tensor shapes.  So how do I do this?

Also, any tips on using MatrixForm in this situation to format the results?
I am using MatrixForm /@ r which works fairly well, but wasn't sure if this
is the right technique.

Thanks ahead of time,

Jordan






  • Prev by Date: Re: Real-time plotting
  • Next by Date: Re: newby plotting question
  • Previous by thread: Re: Re: Constrained optimization.
  • Next by thread: Re: Working with lists of matrices.