A=matrix(QQ,[[4,-2,3], [5,0,2]])
I2=identity_matrix(2) # identity matrix identity_matrix(n), n is the order
I3=identity_matrix(3)
O2=zero_matrix(3, 2) # zero matrix zero_matrix(m, n), m, n are the order
print I2*A
print
print A*I3
print
print A*O2
print
(I2*A)==A
print
(A*I3)==A
|
[ 4 -2 3]
[ 5 0 2]
[ 4 -2 3]
[ 5 0 2]
[0 0]
[0 0]
True
[ 4 -2 3]
[ 5 0 2]
[ 4 -2 3]
[ 5 0 2]
[0 0]
[0 0]
True
|