[Date Index] [Thread Index] [Author Index]
Re: Matrix multiplication problem fixed via dot operation.
On Wed, 22 Feb 2006, Chris Young wrote: > To answer my own posting, it looks like the "dot" operator is needed > when the matrices aren't both square. > > E.g.: a row vector with components a and b times a column vector with > components c and d will yield the correct result, the dot-product. > > I'm still puzzled why Mathematica doesn't do the same thing without the dot. > > Chris Young Beware: though you got no error messages in case of multiplying square matrices with a space between them (as opposed to a dot), the result is NOT a dot product (matrix multiplication), but the matrices are multiplied element by element, e.g. if C = A B then C[[1,1]] equals A[[1,1]] * B[[1,1]], etc. In short, the ordinary multiplication has the attribute Listable. (It can be very useful, e.g. when you have a vector variable x and a vector (list) of coefficients a, to compose them into a x.) Kristjan Kannike <http://www.physic.ut.ee/~kkannike/english/> The same person at different times can seem like a different person; sometimes that person is you. -- Peter Norvig