MathGroup Archive 2006

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

Search the Archive

Re: Matrix Multiplication (with a twist)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68989] Re: [mg68951] Matrix Multiplication (with a twist)
  • From: "Carl K. Woll" <carlw at wolfram.com>
  • Date: Sat, 26 Aug 2006 02:04:25 -0400 (EDT)
  • References: <200608250935.FAA09217@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Bruce Colletti wrote:
> For matrix A = {{e,f},{g,h}} and B = {{a,b},{c,d}}, Mathematica returns their product 
> 
> A.B = {{ae+cf,be+df},{ag+ch,bg+dh}}
> 
> However, I want to treat multiplication of numeric variables as noncommutative in order to instead obtain the result
> 
> {{ea+fc, eb+fd},{ga+hc,gb+hd}}
> 
> How would this be done in v5.2?  Thanks.
> 
> Bruce

One possibility is to use Inner where NonCommutativeMultiply does the 
multiplication:

In[13]:= Inner[NonCommutativeMultiply, A, B, Plus]

Out[13]= {{e ** a + f ** c, e ** b + f ** d}, {g ** a + h ** c,
   g ** b + h ** d}}

I actually prefer using one of the other typesetting symbols with no 
function definition instead, such as CenterDot:

In[14]:= Inner[CenterDot, A, B, Plus]

Out[14]= {{e·a + f·c, e·b + f·d}, {g·a + h·c, g·b + h·d}}

Carl Woll
Wolfram Research


  • Prev by Date: Re: Change of Basis function
  • Next by Date: Re: Change of Basis function
  • Previous by thread: Re: Matrix Multiplication (with a twist)
  • Next by thread: Re: Matrix Multiplication (with a twist)