Ask Your Question

# Revision history [back]

Here is a workaround to your problem.

I still hope someone can give a better explanation of what is going on.

Define u:

sage: x, y = SR.var('x y')
sage: u = vector((x, y, 1 - x - y)


Define v:

sage: M = matrix([[1., 1., -1.], [1., 12., -5.]])
sage: v = M.right_kernel().basis()[0]


Trying to subtract v from u fails, as you noticed.

sage: u - v
Traceback (most recent call last)
...
TypeError: unsupported operand parent(s) for '-': 'Vector space of dimension 3 over Symbolic Ring' and 'Vector space of degree 3 and dimension 1 over Real Field with 53 bits of precision
Basis matrix:
[ 1.00000000000000 0.571428571428571  1.57142857142857]'


But you can force it as follows:

sage: u - u.parent()(v)
(x - 1.00000000000000, y - 0.571428571428571, -x - y - 0.571428571428571)