Do not redefine . in vect.mac, was: Vector ops and non-commutative matrix mult revisited



On 9/6/06, Neilen Marais <nmarais at sun.ac.za> wrote:

> ".." (a, b) := ?mnctimes (a, b);
> infix("..");
>
> since the mnctimes lisp symbol is for non-commutative multiplication. I've
> only recently had the occasion to try it out, but it seems that the vect
> package changes the definition of mnctimes at a lower level, since the ..
> operator still results in commutative multiplication after loading vect.
> In fact, maxima even recognises .. as equivalent to . and simplifies it as
> such.

Sorry, I didn't think it all the way through before. In order to make
sure that ".." (a, b) := ?mnctimes (a, b); doesn't simplify to a . b,
it's necessary to fiddle with the Lisp properties of &., $., and mnctimes.
It is within the realm of possibility.

A different approach is to modify share/vector/vect.mac so that it
does not redefine . to be commutative, which is bad style to begin with.
vect.mac seems to want . to mean the scalar product of vectors
(a.k.a. the dot product) which is common enough outside of Maxima,
but requires changing the built-in properties of . which leads to an
unpleasant surprise (as you know).

vect.mac should probably define a new operator (let's say "dot")
instead of redefining "." . Of course that will cause a problem for
anyone who loads vect and expects . to be redefined.
On the balance, though, I am inclined to fix it now (and accept
the backward incompatibility) rather than revisit this gotcha.
I've bumped into it before myself.

Yet another approach to redefine . only within the vect package.
That would require a working package or namespace scheme,
which we don't have at the moment.

Comments?

Robert Dodier