I have two matrices:

M0:[[1,1],[0.24,0.86]]

M1:[[274,233,331],[120.32,112.96,151.36]]

I calculate M1/M0:

Home view: [[186,141,215],[88,92,116]]

CAS view: [[274,233],[501.33,131.35]]]

The CAS view is wrong and I don't even know how the Prime gets confused...

(12-18-2013 08:44 AM)Tugdual Wrote: [ -> ]The CAS view is wrong and I don't even know how the Prime gets confused...

It's not wrong, it's pointwise division. One should never write A/B for inv(B)*A because matrix multiplication is not commutative and A/B is ambiguous with A*inv(B). Use inv and multiplication.

Use M0^-1*M1. When you "divide" a matrix by another matrix, you are actually pre-multiplying the numerator matrix by the inverse of the denominator matrix.

Thanks for your answers which I understood but I still struggle with something.

M0 is a 2x2 matrix so will M0^-1 be.

M1 is dimension 2x3

you cannot calculate M1 * M0^-1 and even CAS returns a dimension error.

So what the heck is that 2x2 matrix returned by CAS?

There is no possible confusion, I shall expect the correct result or no result at all.

It looks like CAS has done an element by element division of M1 by the corresponding elements of M0. So you get [[274/1, 233/1],[120.32/0.24,112.96/0.86]] with column 3 of matrix M1 truncated. This is basically the result of using the ./ operator i.e. M1 ./ M0, so perhaps that is what CAS thought you wanted to do. Again, you used an incorrect form here, and it's not a problem with CAS.

Thanks Michael, good observation. Now at least we have the beginning of an explanation.

I'm modifying the CAS code so that you will get inv(M0)*M1 with a warning for this misleading notation.