Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Strange matrix product

When I enter

A=matrix([[1,2],[-1,0],[1,1]]) B=matrix([[0,4],[1,-1],[1,2]]) A*B

I get an error message, as expected.

But when I enter

A=matrix(QQ,[[1,2],[-1,0],[1,1]]) B=matrix(QQ,[[0,4],[1,-1],[1,2]]) A*B

I get the output

[ 1 0] [ 1 -2] [ 1 3]

However, if I try

A=matrix(QQ,[[1,2],[-1,0],[1,1]]) B=matrix(QQ,[[0,4],[1,-1],[1,2],[2,2]]) A*B

I get an error message.

In all of the examples I try, Sage will give some output for a matrix product of two matrices of the same size as long as the field QQ is specified for at least one of the matrices. I’ve searched online and haven’t found anything to help me understand this. This will be problematic for my students who might draw the conclusion that the standard matrix product is defined when it really isn't. Can anyone help me understand this?

Strange matrix product

When I enter

A=matrix([[1,2],[-1,0],[1,1]]) B=matrix([[0,4],[1,-1],[1,2]]) A*B

A = matrix([[1, 2], [-1, 0], [1, 1]])
B = matrix([[0, 4], [1, -1], [1, 2]])
A*B

I get an error message, as expected.

But when I enter

A=matrix(QQ,[[1,2],[-1,0],[1,1]]) B=matrix(QQ,[[0,4],[1,-1],[1,2]]) A*B

A = matrix(QQ, [[1, 2], [-1, 0], [1, 1]])
B = matrix(QQ, [[0, 4], [1, -1], [1, 2]])
A*B

I get the output

[ 1  0]
[ 1 -2]
[ 1  3]

3]

However, if I try

A=matrix(QQ,[[1,2],[-1,0],[1,1]]) B=matrix(QQ,[[0,4],[1,-1],[1,2],[2,2]]) A*B

A = matrix(QQ, [[1, 2], [-1, 0], [1, 1]])
B = matrix(QQ, [[0, 4], [1, -1], [1, 2], [2, 2]])
A*B

I get an error message.

In all of the examples I try, Sage will give some output for a matrix product of two matrices of the same size as long as the field QQ is specified for at least one of the matrices. I’ve searched online and haven’t found anything to help me understand this. This will be problematic for my students who might draw the conclusion that the standard matrix product is defined when it really isn't. Can anyone help me understand this? this?

Strange matrix product

When I enter

A = matrix([[1, 2], [-1, 0], [1, 1]])
B = matrix([[0, 4], [1, -1], [1, 2]])
A*B

I get an error message, as expected.

But when I enter

A = matrix(QQ, [[1, 2], [-1, 0], [1, 1]])
B = matrix(QQ, [[0, 4], [1, -1], [1, 2]])
A*B

I get the output

[ 1  0]
[ 1 -2]
[ 1  3]

However, if I try

A = matrix(QQ, [[1, 2], [-1, 0], [1, 1]])
B = matrix(QQ, [[0, 4], [1, -1], [1, 2], [2, 2]])
A*B

I get an error message.

In all of the examples I try, Sage will give some output for a matrix product of two matrices of the same size as long as the field QQ is specified for at least one of the matrices. I’ve searched online and haven’t found anything to help me understand this. This will be problematic for my students who might draw the conclusion that the standard matrix product is defined when it really isn't. Can anyone help me understand this?

Strange matrix product

When I enter

A = matrix([[1, 2], [-1, 0], [1, 1]])
B = matrix([[0, 4], [1, -1], [1, 2]])
A*B

I get an error message, as expected.

But when I enter

A = matrix(QQ, [[1, 2], [-1, 0], [1, 1]])
B = matrix(QQ, [[0, 4], [1, -1], [1, 2]])
A*B

I get the output

[ 1  0]
[ 1 -2]
[ 1  3]

However, if I try

A = matrix(QQ, [[1, 2], [-1, 0], [1, 1]])
B = matrix(QQ, [[0, 4], [1, -1], [1, 2], [2, 2]])
A*B

I get an error message.

In all of the examples I try, Sage will give some output for a matrix product of two matrices of the same size as long as the field QQ is specified for at least one of the matrices. I’ve searched online and haven’t found anything to help me understand this. This will be problematic for my students who might draw the conclusion that the standard matrix product is defined when it really isn't. Can anyone help me understand this?