MathGroup Archive 2011

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116437] Re: Mathematica: subscript simplification under non-communicative multiplication.
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Tue, 15 Feb 2011 06:34:28 -0500 (EST)
  • References: <ijash7$nel$1@smc.vnet.net>

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


  • Prev by Date: Re: Using Mathematica for text mining
  • Next by Date: (MathLink) Correct handling of Messages generated by slave kernel
  • Previous by thread: Mathematica: subscript simplification under non-communicative multiplication.
  • Next by thread: Re: Mathematica: subscript simplification under non-communicative multiplication.