Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using sage to check if a vector is in a matrix's null space

I want to check if a given vector is inside a matrix's null space.

Here is what I have done:

#Define a matrix

#Free variables to be used in the given vector
var('s t')

#The null space of the matrix A


#Create a vector

#If ans is in the null space of A, then A*ans is the 0 vector
print A*ans

#If A*ans is the 0 vector, then the following should be true too
print ans in ns

I had expected the last print statement to be true since A*ans results in a zero vector, hence ans is in the null space of A.

Why isn't this the case?