"Stavros Macrakis" <macrakis at alum.mit.edu> writes:
> On 6/10/07, Nikos Apostolakis <nikos.ap at gmail.com> wrote:
>
> ...It seems that "." in maxima stands for two distinct operations,
>
> the inner product (aka scalar product, aka dot product) of
> vectors and matrix multiplication.
>
>
> Yes, Maxima is sloppy about the distinction, but this is partly intentional, as
> a convenience feature which can be toggled with scalarmatrixp.
>
I don't see the *existence* of this feature as a bug. What I
consider a bug is its implemenation. IOW, I don't mind that much
that the same symbol is used for two different operations or that
there is a flag to choose the preffered operation in cases of
ambiguity. What I see as a problem is that cases that shouldn't be
ambiguous are treated as such. If one wants to multiply two 3 x 1
matrices they most probably mean the scalar product as this is the
only product that makes sence; so the result should *always* be a
number and scalarmartixp should have nothing to do with it. OTOH,
If one multiplies an 1 x n and an n x 1 matrix the type of the
result should be decided by the value of scalarmartrixp (which
incidentaly I think should default to "false").
> As for Jamie's example, Maxima also interprets lists as 1x matrices but
> transposes them to x1 matrices when necessary:
>
> [1,2] . matrix( [1,2,3],[4,5,6]); => matrix([9,12,15]) 1x2 . 2x3 =>
> 1x3 OK
> matrix( [1,2,3],[3,4,5]) . [1,2,3] => matrix([14],[26]) 2x3 . 1x3 =>
> 2x1 auto-transpose
This is not that bad. A list can be interpreted either as an 1 x n
or as an n x 1 matrix and *both* interpetations are natural even though
the usual visual representation of lists coincide with the usual
visual interpetation of 1 x n matrices. I would however argue that
matrix( [1,2,3],[3,4,5]) . matrix([1,2,3]);
[ 14 ]
=> [ ]
[ 26 ]
is problematic, since in this case we have explicitly requested that
[1,2,3] be treated as a 1 x 3 matrix. This should raise an error IMO.
> [1,2,3] . matrix([5],[6],[7]) => 38
> 1x3 . 3x1 => scalar
IMO, this should depend on the value of scalarmatrixp.
> [1,2,3] . [5,6,7] =>
> 38 1x3 . 1x3 => scalar
>
>
IMO, this should always be a scalar.
> Convenience and rigor are often at odds. I am normally a proponent of rigor,
> but I am undecided in this case.
I am all for convenience but in this particular case I am not sure
that the current behavior of maxima is convenient.
> What are cases where Maxima's current behavior would cause
> problems?
>
For example, I was working with some matrices which can in some
cases be 1 x 1. (Specifically these were the matrices coming from
the reduced Burau representation of the Braid Group.) I was doing
some operations like multiplying, evaluating at some specific values
of t, and extracting certain submatrices and matrix elements. In
some cases I was getting some very strange answers. For example at
some point I got an answer
1
(-)
9 1, 1
It took me a while to figure out what was going on.
Best,
Nikos