Barton,
If you declare the matrix elements scalar, the non-commutative ops
will simplify to commutative.
-s
On 11/4/09, Barton Willis <willisb at unk.edu> wrote:
>
> Consider a list of matrices
>
> (%i2) s : [matrix([1,2],[3,4]), matrix([a,b],[c,d])]$
>
> OK
>
> (%i3) first(s).first(s) + second(s).second(s);
> (%o3) matrix([b*c+a^2+7,b*d+a*b+10],[c*d+a*c+15,d^2+b*c+22])
>
> Can we do this with s.s? No, to get the dot product to work, we need
> to set matrix_element_mult to noncummuative multiplication, but then
> the matrix products are done with noncommuative multiplication too.
>
> (%i4) matrix_element_mult : "."$
>
> (%i5) s.s;
> (%o5) matrix([b . c+a^^2+7,b . d+a . b+10],[d . c+c . a+15,d^^2+c . b+22])
>
> When ratmx is true (often a good choice), it's worse
>
> (%i6) ratmx : true$
> (%i7) s.s;
>
> Unsimplified:
>
> (%o7) matrix([1,2],[3,4])^2+matrix([a,b],[c,d])^2
> (%i8) expand(%,0,0);
> (%o8) matrix([a^2+1,b^2+4],[c^2+9,d^2+16])
>
> Barton
>
> Barton
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>