Ask Your Question

Revision history [back]

Using dot-tab exploration on v and on V reveals a solution.

The (maybe slightly surprising at first) solution is to ask V for the coordinates of v.

Let us replay the whole sequence.

Define a matrix, compute its kernel, display it.

sage: A = Matrix([[1, 1, 1]])
sage: V = A.right_kernel()
sage: V
Free module of degree 3 and rank 2 over Integer Ring
Echelon basis matrix:
[ 1  0 -1]
[ 0  1 -1]

Create a vector as an element of the kernel.

sage: v = V([2, -1, -1])
sage: v
(2, -1, -1)
sage: v in V
True

Try typing v. then hitting the TAB key. Same with V. and TAB key.

Found a promising method coordinates for V which gives a list:

sage: V.coordinates(v)
[2, -1]

To get a vector:

sage: V.coordinate_vector
(2, -1)

Check:

sage: V.linear_combination_of_basis((2, -1))
(2, -1, -1)

Using dot-tab exploration on v and on V reveals a solution.

The (maybe Maybe slightly surprising surprisingly at first) solution is to first, one can ask V for the coordinates of v.

Let us replay the whole sequence.

Define a matrix, compute its kernel, display it.

sage: A = Matrix([[1, 1, 1]])
sage: V = A.right_kernel()
sage: V
Free module of degree 3 and rank 2 over Integer Ring
Echelon basis matrix:
[ 1  0 -1]
[ 0  1 -1]

Create a vector as an element of the kernel.

sage: v = V([2, -1, -1])
sage: v
(2, -1, -1)
sage: v in V
True

Try typing v. then hitting the TAB key. Same with V. and TAB key.

Found a There are promising method methods coordinates and coordinate_vector for V which .

One gives the coordinates as a list:

sage: V.coordinates(v)
[2, -1]

To get The other one gives the coordinates as a vector:

sage: V.coordinate_vector
(2, -1)

Check:Check the result with the linear_combination_of_basis method:

sage: V.linear_combination_of_basis((2, -1))
(2, -1, -1)

Using dot-tab exploration on v and on V reveals a solution.

Maybe slightly surprisingly at first, one can ask V for the coordinates of v.

Let us replay the whole sequence.

Define a matrix, compute its kernel, display it.

sage: A = Matrix([[1, 1, 1]])
sage: V = A.right_kernel()
sage: V
Free module of degree 3 and rank 2 over Integer Ring
Echelon basis matrix:
[ 1  0 -1]
[ 0  1 -1]

Create a vector as an element of the kernel.

sage: v = V([2, -1, -1])
sage: v
(2, -1, -1)
sage: v in V
True

Try typing v. then hitting the TAB key. Same with V. and TAB key.

There are promising methods coordinates and coordinate_vector for V.

One gives the coordinates as a list:

sage: V.coordinates(v)
[2, -1]

The other one gives the coordinates as a vector:

sage: V.coordinate_vector
V.coordinate_vector(v)
(2, -1)

Check the result with the linear_combination_of_basis method:

sage: V.linear_combination_of_basis((2, -1))
(2, -1, -1)