Re: Mathematica: subscript simplification under non-communicative multiplication.

• To: mathgroup at smc.vnet.net
• Subject: [mg116458] Re: Mathematica: subscript simplification under non-communicative multiplication.
• From: Simon <simonjtyler at gmail.com>
• Date: Wed, 16 Feb 2011 04:34:35 -0500 (EST)
• References: <ijash7\$nel\$1@smc.vnet.net> <ijdobr\$fc5\$1@smc.vnet.net>

```On Feb 15, 10:34 pm, Ray Koopman <koop... at sfu.ca> wrote:
> On Feb 14, 1:27 am, Cantormath <cantorm... at gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > Using Subscript[variable, integer] in Mathematica 7.0+, I have
> > expressions of the following form:
>
> > a_-4 ** b_1 ** a_-4 ** b_-4 ** a_1 ** c_-4 ** c_1 ** c_5
>
> > I would like to simplify this expression.
> > Rules:
> > Variables with the same subscript to don't commute,
> > variables with different subscripts do commute.
>
> > I need a way to simplify the expression and combine like terms
> > (if possible); the output should be something like:
>
> > (a_-4)^2 ** b_-4 ** c_-4 ** b_1 ** a_1 ** c_1 ** c_5
>
> > The most important thing I need is to order the terms in the
> > expression by subscripts while preserving the rules about what
> > commutes and what does not. The second thing (I would like) to do
> > is to combine like terms once the order is correct. I need to at
> > least order expressions like above in the following way:
>
> > a_-4 ** a_-4 ** b_-4 ** c_-4 ** b_1 ** a_1 ** c_1 ** c_5,
>
> > that is, commute variables with different subscripts while preserving
> > the non-communicative nature of variables with the same subscripts.
>
> > All Ideas are welcome, thanks.
>
> I've split this into separate statements to make it easier to follow:
>
> Subscript @@@ {{a,-4},{b,1},{a,-4},{b,-4},{a,1},{c,-4},{c,1},{c,5}} ;
> Split@Sort[ %, #1[[2]] <= #2[[2]]& ] ;
> NonCommutativeMultiply @@ ( #[[1]]^Length@# & /@ % )
>
> (a_-4)^2 ** b_-4 ** c_-4 ** b_1 ** a_1 ** c_1 ** c_5

I like the use of Split to extract the powers.

```

• Prev by Date: Re: request help
• Next by Date: Re: 3D surface plots - non deletion of data inside undesirable
• Previous by thread: Re: Mathematica: subscript simplification under non-communicative multiplication.
• Next by thread: Import and Process QuickTime