Ask Your Question

Revision history [back]

r is correctly defined. For s, i would just do:

sage: s = matrix(QQ,[2,-3,-4]).right_kernel()
sage: s
Vector space of degree 3 and dimension 2 over Rational Field
Basis matrix:
[   1    0  1/2]
[   0    1 -3/4]

Then you can do:

sage: s.intersection(r)
Vector space of degree 3 and dimension 1 over Rational Field
Basis matrix:
[    1    15 -43/4]

And check

sage: r.intersection(s)
Vector space of degree 3 and dimension 1 over Rational Field
Basis matrix:
[    1    15 -43/4]

sage: b = r.intersection(s).basis()[0] ; b
(1, 15, -43/4)
sage: b in r
True
sage: b in s
True

r is correctly defined. For s, i would just do:

sage: s = matrix(QQ,[2,-3,-4]).right_kernel()
sage: s
Vector space of degree 3 and dimension 2 over Rational Field
Basis matrix:
[   1    0  1/2]
[   0    1 -3/4]

Then you can do:

sage: s.intersection(r)
Vector space of degree 3 and dimension 1 over Rational Field
Basis matrix:
[    1    15 -43/4]

And check

sage: r.intersection(s)
Vector space of degree 3 and dimension 1 over Rational Field
Basis matrix:
[    1    15 -43/4]

sage: b = r.intersection(s).basis()[0] ; b
(1, 15, -43/4)
sage: b in r
True
sage: b in s
True

As a general rule, unlike say complex analysis, Sage already offers precise objects to work with linear spaces, polynomials, combinatorics, so that you should avoid the use of fuzzy symbolic things.