Prevent commutation of elements within non-commutative matrix multiplication.



Matthew Everitt <mat.everitt at gmail.com> writes:
> Hi,
>
> I'm reasonably new to working with matrices in maxima, and I'm having a
> problem I hope someone can help me with.
> It seems that the inner product is assuming that the elements of a matrix
> commute, so running:
>
> declare([a,b],nonscalar)$
> display2d:false$
> A:matrix([0,a],[b,0])$
> A.A;
>
> gives
> matrix([a*b,0],[0,a*b])
> rather than matrix([a.b,0],[0,b.a]), which is what I need. Is there any way
> around this?

I think you want:

 -- Option variable: matrix_element_mult
     Default value: `*'

     `matrix_element_mult' is the operation invoked in place of
     multiplication in a matrix multiplication.  `matrix_element_mult'
     can be assigned any binary operator.  The assigned value may be
     the name of an operator enclosed in quote marks, the name of a
     function, or a lambda expression.

     The dot operator `.' is a useful choice in some contexts.

     See also `matrix_element_add' and `matrix_element_transpose'.

then you get:

Maxima 5.25post http://maxima.sourceforge.net
using Lisp SBCL 1.0.52.0.debian
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) A:matrix([0,a],[b,0])$

(%i2) A.A;
                                 [ a b   0  ]
(%o2)                            [          ]
                                 [  0   a b ]
(%i3) matrix_element_mult: ".";
(%o3)                                  .
(%i4) A.A;
                               [ a . b    0   ]
(%o4)                          [              ]
                               [   0    b . a ]
(%i5) 



Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20111104/fcbd7337/attachment.pgp>;