Lexicographic ordering



On 12/15/08, Askunky <askunky at yahoo.fr> wrote:

>  I have  problems with matrix products...
>  matrix([A,B],[C,D]) squared gives:
>  matrix([B*C+A^2,B*D+A*B],[C*D+A*C,D^2+B*C])
>
>  How could I get the right result?

I'm guessing that you mean to say the terms are ordered in reverse
of what you expected. The global flag powerdisp governs the order
of terms when literal sums are displayed. Try this:

aa : matrix ([A, B], [C, D]);
powerdisp : true;
aa . aa;
 => matrix([A^2+B*C,A*B+B*D],[A*C+C*D,B*C+D^2])

best

Robert Dodier