ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 04 Feb 2016 16:28:39 +0100Will "solve_right" return integer solutions if one exists?https://ask.sagemath.org/question/32430/will-solve_right-return-integer-solutions-if-one-exists/ If A is an integer matrix and b is an integer vector, then will the command `A.solve_right(b)` return an integer vector if the equation Ax=b is solvable over the integers?
Wed, 03 Feb 2016 20:08:49 +0100https://ask.sagemath.org/question/32430/will-solve_right-return-integer-solutions-if-one-exists/Answer by vdelecroix for <p>If A is an integer matrix and b is an integer vector, then will the command <code>A.solve_right(b)</code> return an integer vector if the equation Ax=b is solvable over the integers?</p>
https://ask.sagemath.org/question/32430/will-solve_right-return-integer-solutions-if-one-exists/?answer=32432#post-id-32432The answer is no
sage: A = matrix(2,3, [3,4,1,5,9,2])
sage: A.solve_right(vector((1,2)))
(1/7, 1/7, 0)
sage: A * vector((0,0,1))
(1, 2)Wed, 03 Feb 2016 22:09:04 +0100https://ask.sagemath.org/question/32430/will-solve_right-return-integer-solutions-if-one-exists/?answer=32432#post-id-32432Comment by kcrisman for <p>The answer is no</p>
<pre><code>sage: A = matrix(2,3, [3,4,1,5,9,2])
sage: A.solve_right(vector((1,2)))
(1/7, 1/7, 0)
sage: A * vector((0,0,1))
(1, 2)
</code></pre>
https://ask.sagemath.org/question/32430/will-solve_right-return-integer-solutions-if-one-exists/?comment=32446#post-id-32446There is the natural question of how to *get* integer solutions in an efficient manner... but presumably one could create arbitrarily annoying matrices where that would not be so easy to do programmatically?Thu, 04 Feb 2016 14:50:07 +0100https://ask.sagemath.org/question/32430/will-solve_right-return-integer-solutions-if-one-exists/?comment=32446#post-id-32446Comment by vdelecroix for <p>The answer is no</p>
<pre><code>sage: A = matrix(2,3, [3,4,1,5,9,2])
sage: A.solve_right(vector((1,2)))
(1/7, 1/7, 0)
sage: A * vector((0,0,1))
(1, 2)
</code></pre>
https://ask.sagemath.org/question/32430/will-solve_right-return-integer-solutions-if-one-exists/?comment=32449#post-id-32449It is not so hard either ;-) Just some arithmetic with Z-modules.Thu, 04 Feb 2016 16:28:39 +0100https://ask.sagemath.org/question/32430/will-solve_right-return-integer-solutions-if-one-exists/?comment=32449#post-id-32449