MathGroup Archive 2006

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

Search the Archive

Re: Matrix Multiplication (with a twist)


On 25 ago 2006, at 11:35, 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
>

In[1]:=
A = {{e,f},{g,h}} ; B = {{a,b},{c,d}};
Inner[NonCommutativeMultiply, A, B, Plus]

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

Adriano Pascoletti


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