ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 20 Jan 2014 23:38:33 -0600A bug with solve()?http://ask.sagemath.org/question/10634/a-bug-with-solve/I'm trying to solve a toy linear system. Why does the result depend on the order of variables and on the repetition of the equations?
sage: var("x,y")
(x, y)
sage: solve([y==0],x,y)
([], [])
sage: solve([y==0],y,x)
([y == 0], [1])
sage: solve([y==0,y==0],x,y)
[[x == r3, y == 0]]Mon, 20 Jan 2014 03:13:47 -0600http://ask.sagemath.org/question/10634/a-bug-with-solve/Answer by tmonteil for <p>I'm trying to solve a toy linear system. Why does the result depend on the order of variables and on the repetition of the equations?</p>
<pre><code>sage: var("x,y")
(x, y)
sage: solve([y==0],x,y)
([], [])
sage: solve([y==0],y,x)
([y == 0], [1])
sage: solve([y==0,y==0],x,y)
[[x == r3, y == 0]]
</code></pre>
http://ask.sagemath.org/question/10634/a-bug-with-solve/?answer=15949#post-id-15949I agree that this is a bug, and the function `solve()` is full of bugs. The symbolic ring lacks semantics, here we do not know where do `x` and `y` live (there exists an assumption system, but it does not work correctly). I would advise to avoid the symbolic ring as much as possible, in your case, perhaps the right place is to consider the equation as a linear one over, say, the rationals:
sage: Proj = Matrix(QQ, [0, 1]) ; Proj
[0 1]
sage: Proj.right_kernel()
Vector space of degree 2 and dimension 1 over Rational Field
Basis matrix:
[1 0]
And you can check that your last equation is equivalent to your first one:
sage: ProjTwice = Matrix(QQ, [[0, 1],[0,1]]) ; ProjTwice
[0 1]
[0 1]
sage: ProjTwice.right_kernel()
Vector space of degree 2 and dimension 1 over Rational Field
Basis matrix:
[1 0]
sage: Proj.right_kernel() == ProjTwice.right_kernel()
True
Mon, 20 Jan 2014 23:38:33 -0600http://ask.sagemath.org/question/10634/a-bug-with-solve/?answer=15949#post-id-15949