Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12281

Re: Non Commutative Multiply

From Ray Koopman <koopman@sfu.ca>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Non Commutative Multiply
Date 2012-11-09 00:00 +0000
Message-ID <k7hh2k$nud$1@smc.vnet.net> (permalink)
References <k7fm4l$jko$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


On Nov 7, 11:16 pm, Rodrigo AP <digo...@gmail.com> wrote:
> 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
> Times2[a_,b_]:=Times[a,b]
> and then use ClearAttributes[Times2, Orderless] but it doesn't work.
>
> How could I solve this problem?
>
> Thanks in advance
>
> Rodrigo

Inner[NonCommutativeMultiply,A,B,Plus]

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

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Non Commutative Multiply Rodrigo AP <digorna@gmail.com> - 2012-11-08 07:14 +0000
  Re: Non Commutative Multiply Ray Koopman <koopman@sfu.ca> - 2012-11-09 00:00 +0000
  Re: Non Commutative Multiply mstankus@gmail.com - 2012-11-09 00:01 +0000
  Re: Non Commutative Multiply Roland Franzius <roland.franzius@uos.de> - 2012-11-09 00:01 +0000
  Re: Non Commutative Multiply David Bailey <dave@removedbailey.co.uk> - 2012-11-09 00:01 +0000
  Re: Non Commutative Multiply daniel.lichtblau0@gmail.com - 2012-11-09 00:02 +0000

csiph-web