Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 2012-11-20 08:18:41 -0600

DSM gravatar image

That's how numpy matrices work, so one possibilities is to write:

sage: M = Matrix([[1,2,3],[0,4,5],[0,0,6]])
sage: M.numpy()                            
array([[1, 2, 3],
       [0, 4, 5],
       [0, 0, 6]])
sage: M.numpy() == 0
array([[False, False, False],
       [ True, False, False],
       [ True,  True, False]], dtype=bool)
sage: M.numpy() == zero_matrix(ZZ, 3)
array([[False, False, False],
       [ True, False, False],
       [ True,  True, False]], dtype=bool)

That's how numpy matrices work, so one possibilities possibility is to write:

sage: M = Matrix([[1,2,3],[0,4,5],[0,0,6]])
sage: M.numpy()                            
array([[1, 2, 3],
       [0, 4, 5],
       [0, 0, 6]])
sage: M.numpy() == 0
array([[False, False, False],
       [ True, False, False],
       [ True,  True, False]], dtype=bool)
sage: M.numpy() == zero_matrix(ZZ, 3)
array([[False, False, False],
       [ True, False, False],
       [ True,  True, False]], dtype=bool)