Re: symbolic matrix manipulation

• To: mathgroup at smc.vnet.net
• Subject: [mg96080] Re: [mg96042] symbolic matrix manipulation
• From: Daniel Lichtblau <danl at wolfram.com>
• Date: Wed, 4 Feb 2009 05:21:18 -0500 (EST)
• References: <200902031130.GAA00228@smc.vnet.net>

```ashwin.tulapurkar at gmail.com wrote:
> Hi,
> I am trying to simplify the following matrix expression:
> a.b.b.a with the rule: replace a.b by (b.a+1). So I expect the final
> output to be
> a.b.b.a --> (b.a+1).b.a --> b.a.b.a+b.a --> b.(b.a+1).a+b.a -->
> b.b.a.a + 2 b.a
>
> Can you tell me how to do this?
>
> Thanks.
> -Ashwin

This really looks more like something from a general setting of
noncommutative algebra. I'll recast that way so as to avoid explicit use
of matrix operators such as Dot, which will not handle this well. I'm
http://library.wolfram.com/infocenter/Conferences/325/

I use a "multiplication" operator I call ncTimes. I designate the symbol
s for variables to be treated as noncommuting. We impose a commutator
relation that s[i] s[j] = s[j] s[i] + 1 for j>i (so we just need to make
sure b correspnds to an s ariable with larger index than a).

ncTimes[] := 1
ncTimes[a_] := a
ncTimes[a___,x_+y_,b___] := ncTimes[a,x,b] + ncTimes[a,y,b]
ncTimes[a___,ncTimes[b_,c__],d___] := ncTimes[a,b,c,d]
ncTimes[a___,i_Integer*c_,b___] := i*ncTimes[a,c,b]
ncTimes[a___,i_Integer,b___] := i*ncTimes[a,b]
ncTimes[a___,s[i_Integer],s[j_Integer],b___] /; j>i :=
ncTimes[a,s[j],s[i],b]+ncTimes[a,b]

a = s[1];
b = s[2];

Your example, in this setting, is done as below.

In[10]:= ncTimes[a,b,b,a]
Out[10]= 2 ncTimes[s[2], s[1]] + ncTimes[s[2], s[2], s[1], s[1]]

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: Re: Log[x]//TraditionalForm
• Next by Date: Re: Taking sums across indices of a
• Previous by thread: symbolic matrix manipulation
• Next by thread: Re: symbolic matrix manipulation