MathGroup Archive 2012

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

Search the Archive

Non Commutative Multiply

  • To: mathgroup at
  • Subject: [mg128593] Non Commutative Multiply
  • From: Rodrigo AP <digorna at>
  • Date: Thu, 8 Nov 2012 02:09:06 -0500 (EST)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:

Dear group,

I want to multiply two matrices, for example,

A = {{e, f}, {g, h}}
B = {{a, b}, {c, d}}

Using A.B, Mathematica returns

{{a e + b g, a f + b h}, {c e + d g, c f + d h}}

I would like to get, however, the following result:

{{e a + f c, e b + f d}, {g a + h c, g b + h d}}

since, for me, the entries {a,b,c,d,e,f,g,h} are operators, i.e., they
are non-commutative.

I could solve this problem clearing the attribute "Orderless" in the
built-in function Times:

ClearAttributes[Times, Orderless]

I know, however, this can be dangerous. I tried to define a function
and then use ClearAttributes[Times2, Orderless] but it doesn't work.

How could I solve this problem?

Thanks in advance


  • Prev by Date: Re: Manipulate help
  • Next by Date: Re: Help with map /@
  • Previous by thread: Re: FindFit::nrlnum Error Message
  • Next by thread: Re: Non Commutative Multiply