Author 
Comment/Response 
szbszig

09/21/09 5:44pm
Hi!
I have the following problem. If I have a long symbolic expression with matrix and scalar variables and also commutative and noncommutative multiplications in it, is it somehow possible to:
 expand it, so get rid of the parentheses;
 simplify it, so sum those terms which have the same scalar coefficient?
For example consider the following iteration:
F*z + R.L*z + R.R.B*z /. R > F*z + R.L*z + R.R.B*z
It yields:
F z + z (F z + z R.L + z R.R.B).L +
z (F z + z R.L + z R.R.B).(F z + z R.L + z R.R.B).B
Where z is a scalar variable, and B, F, L, R are matrices.
I would like to bring the latter expression into a form like:
z F + z^2 (F.L + R.L.L + R.R.B.L) + z^3 (F.F.B + R.L.R.L.B + R.R.B.R.R.B + F.R.L.B + R.L.F.B + F.R.R.B.B + R.R.B.F.B + R.L.R.R.B.B + R.R.B.R.L.B)
However, neither Expand[], nor Simplify[] seems to do anything useful with it.
I even tried NonCommutativeMultiply (**) instead of Dot (.), and found out that "Expand and Simplify do not operate on expressions with NonCommutativeMultiply"...
Thanks very much!
URL: , 
