1 | initial version |
Since you have linear equations, it'd be more straightforward and efficient to employ linear algebra rather than symbolic solve()
function.
If I got you manipulations correctly, then instead of my_solve
you can simply use
M = matrix(QQ, 3, [2,1,0,-1,0, 0,1,0,1,1, 1,0,-1,2,0])
v = vector(QQ, [4,4,0])
s = M.solve_right(v)
K = M.right_kernel().basis()
print(s)
print(K)
which prints
(0, 4, 0, 0, 0)
[
(1, 0, 5, 2, -2),
(0, 1, 2, 1, -2)
]
These are exactly the "free term" and the vectors (up to a factor) you multiply by w
and u
in the solution you search for.
2 | No.2 Revision |
Since you have linear equations, it'd be more straightforward and efficient to employ linear algebra rather than symbolic solve()
function.
If I got you your manipulations correctly, then instead of
you can simply usemy_solvemy_solve()
M = matrix(QQ, 3, [2,1,0,-1,0, 0,1,0,1,1, 1,0,-1,2,0])
v = vector(QQ, [4,4,0])
s = M.solve_right(v)
K = M.right_kernel().basis()
print(s)
print(K)
which prints
(0, 4, 0, 0, 0)
[
(1, 0, 5, 2, -2),
(0, 1, 2, 1, -2)
]
These are exactly the "free term" and the vectors (up to a factor) you multiply by w
and u
in the solution you search for.
3 | No.3 Revision |
Since you have linear equations, it'd be more straightforward and efficient to employ linear algebra rather than symbolic solve()
function.
If I got your manipulations correctly, then instead of my_solve()
you can simply use
M = matrix(QQ, 3, [2,1,0,-1,0, 0,1,0,1,1, 1,0,-1,2,0])
v = vector(QQ, [4,4,0])
s = M.solve_right(v)
K = M.right_kernel().basis()
print(s)
print(K)
which prints
(0, 4, 0, 0, 0)
[
(1, 0, 5, 2, -2),
(0, 1, 2, 1, -2)
]
These are exactly the "free term" and the vectors (up to a factor) you multiply by real coefficients w
and u
in to obtain the solution you search for.