Ask Your Question

Revision history [back]

Your vector ans is not in A.kernel() because of how A.kernel() is defined. From its documentation:

Returns the left kernel of this matrix, as a vector space or free
module. This is the set of vectors "x" such that "x*self = 0".

Note: For the right kernel, use "right_kernel()".  The method
"kernel()" is exactly equal to "left_kernel()".

So with A and ans defined as you did:

sage: ans in A.kernel()
False
sage: ans in A.right_kernel()
True

A.right_kernel() is what you want.

Your vector ans is not in A.kernel() because of how A.kernel() is defined. From its documentation:

Returns the left kernel of this matrix, as a vector space or free
module. This is the set of vectors "x" such that "x*self = 0".

Note: For the right kernel, use "right_kernel()".  The method
"kernel()" is exactly equal to "left_kernel()".

So with since ans * A and is not zero, ans defined as you did:is not in A.kernel().

sage: ans in A.kernel()
False
sage: ans in A.right_kernel()
True

A.right_kernel() is what you want.