Re: Commuting Matrices

*To*: mathgroup at smc.vnet.net*Subject*: [mg24639] Re: Commuting Matrices*From*: Sotirios Bonanos <sbonano at mail.ariadne-t.gr>*Date*: Mon, 31 Jul 2000 09:23:13 -0400 (EDT)*Organization*: National Technical University of Athens, Greece*References*: <8lgs2f$2b9@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Vishnu Jejjala wrote: > I have a collection of matrices which satisfy a matrix algebra. > Call three of the matrices Phi1, Phi2, and Phi3. I want to take > expressions of the form (Phi1.Phi2.Phi3)^n and `normal order' them > using the commutation relations of the algebra so that the terms > in the expansion are of the form Phi1^a.Phi2^b.Phi3^c. Is there > a slick way to do this? > > My brute force method of using replaces isn't working. One of > the problems I run into is that when I obtain an expression like > Phi3.(k Phi1.Phi3).Phi2.Phi3, I can't seem to teach Mathematica > to realize that the k is a scalar and factors through and that it > should apply the commutation rules to k Phi3.Phi1.Phi3.Phi2.Phi3. > > Perhaps someone can offer suggestions. Thanks. > > --Vishnu Hi Vishnu, You must first teach "Dot" to distinguish scalars from matrices, and then apply the rules of your algebra. Here is one way: In[1]:= MatNameList={Phi1,Phi2,Phi3}; In[2]:= Unprotect[Dot]; Dot[x_,y_+z_]=x.y+x.z; Dot[x_+y_,z_]=x.z+y.z; (** The above rules are not needed if your "Algebra Rules" do not involve sums of matrices **) Dot[x_,Times[y_^n_.,z_]]:=y^n x.z/;(!MemberQ[MatNameList,y]); Dot[Times[y_^n_.,z_],x_]:=y^n z.x/;(!MemberQ[MatNameList,y]); (*** Sample of "Algebra Rules" ***) Phi1.Phi2=a1 Phi1+a2 Phi2+a3 Phi3; Phi2.Phi1=b1 Phi1+b2 Phi2+b3 Phi3; Phi1.Phi3=c1 Phi1+c2 Phi2+c3 Phi3; Phi3.Phi1=d1 Phi1+d2 Phi2+d3 Phi3; Phi2.Phi3=e1 Phi1+e2 Phi2+e3 Phi3; Phi3.Phi2=f1 Phi1+f2 Phi2+f3 Phi3; Phi1^m_..Phi1^n_.=Phi1^(m+n); (** etc **) Protect[Dot]; (** Now Dot behaves as you want. Try the following: **) In[3]:= Phi1.(a Phi1+b Phi2+c Phi3).( k2 Phi1^2+k1 Phi1+l Phi2+m Phi3) In[4]:= Collect[%,MatNameList,Factor] Hope this helps. S. Bonanos