Re: matrices
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: matrices
- From: Frank Zizza <zizza at pioneer.willamette.edu>
- Date: Fri, 2 Apr 93 12:39:35 -0800
If your expressions are symbolic then the following modification to Dot will do the trick. janus> math -noinit Mathematica 2.1 for NeXT Copyright 1988-92 Wolfram Research, Inc. In[1]:= Unprotect[Dot]; In[2]:= Dot[A___, h_?NumberQ B_, C___] := h Dot[A, B, C] In[3]:= eps /: NumberQ[eps] = True; In[4]:= Distribute[(A + eps B).(A + eps B)] 2 Out[4]= A . A + eps A . B + eps B . A + eps B . B In[5]:= Collect[%, eps] 2 Out[5]= A . A + eps (A . B + B . A) + eps B . B Regards, Frank Zizza Willamette University zizza at willamette.edu