HP Forums
[BUG]: matrices - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: [BUG]: matrices (/thread-152.html)



[BUG]: matrices - Tugdual - 12-18-2013 08:44 AM

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...


RE: [BUG]: matrices - parisse - 12-18-2013 02:29 PM

(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.


RE: [BUG]: matrices - Michael de Estrada - 12-18-2013 02:32 PM

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.


RE: [BUG]: matrices - Tugdual - 12-18-2013 10:34 PM

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.


RE: [BUG]: matrices - Michael de Estrada - 12-18-2013 11:05 PM

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.


RE: [BUG]: matrices - Tugdual - 12-18-2013 11:11 PM

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


RE: [BUG]: matrices - parisse - 12-19-2013 08:53 AM

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