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


Groups > comp.soft-sys.math.mathematica > #12293 > unrolled thread

Re: Non Commutative Multiply

Started byBob Hanlon <hanlonr357@gmail.com>
First post2012-11-09 00:02 +0000
Last post2012-11-09 00:02 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Non Commutative Multiply Bob Hanlon <hanlonr357@gmail.com> - 2012-11-09 00:02 +0000

#12293 — Re: Non Commutative Multiply

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-11-09 00:02 +0000
SubjectRe: Non Commutative Multiply
Message-ID<k7hh6f$o0d$1@smc.vnet.net>
Use Inner

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

Inner[NonCommutativeMultiply, A, B]

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

(% /. NonCommutativeMultiply -> Times) == A.B

True


Bob Hanlon


On Thu, Nov 8, 2012 at 2:09 AM, Rodrigo AP <digorna@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
>
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web