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.Sun, 15 Dec 2013 07:31:06 +0100Finding coprime integer solutionshttps://ask.sagemath.org/question/7888/finding-coprime-integer-solutions/I'm looking to find a way to find all coprime integer solutions to an equation. As an example, the equation x*y + y*z + z*x == 0, which I already know the answer to. Thanks!Thu, 20 Jan 2011 18:45:54 +0100https://ask.sagemath.org/question/7888/finding-coprime-integer-solutions/Comment by kcrisman for <p>I'm looking to find a way to find all coprime integer solutions to an equation. As an example, the equation x<em>y + y</em>z + z*x == 0, which I already know the answer to. Thanks!</p>
https://ask.sagemath.org/question/7888/finding-coprime-integer-solutions/?comment=22252#post-id-22252Being a little more explicit about your question might help us help you. Are you looking for programming ideas? A command? What does "all coprime solutions" mean, precisely. Thanks!Mon, 24 Jan 2011 11:31:38 +0100https://ask.sagemath.org/question/7888/finding-coprime-integer-solutions/?comment=22252#post-id-22252Answer by John Cremona for <p>I'm looking to find a way to find all coprime integer solutions to an equation. As an example, the equation x<em>y + y</em>z + z*x == 0, which I already know the answer to. Thanks!</p>
https://ask.sagemath.org/question/7888/finding-coprime-integer-solutions/?answer=15815#post-id-15815Since your equation is homogeneous in 3 variables it defines a projective curve, and it is possible to search for points on it like this:
sage: P2Q.<x,y,z> = ProjectiveSpace(QQ,2)
sage: f = x*y+y*z+z*x
sage: C = Curve(f)
sage: C
Projective Conic Curve over Rational Field defined by x*y + x*z + y*z
sage: C.rational_points(bound=10)
[(-3 : -3/2 : 1),
(-2 : -2 : 1),
(-3/2 : -3 : 1),
(-2/3 : 2 : 1),
(-1/2 : 1 : 1),
(-1/3 : 1/2 : 1),
(0 : 0 : 1),
(0 : 1 : 0),
(1/2 : -1/3 : 1),
(1 : -1/2 : 1),
(1 : 0 : 0),
(2 : -2/3 : 1)]
Note that the current implementation of point-finding on plane curves over QQ is very naive, but a better implementation is currently under development.
Secondly, the solutions are presented in projective coordinates normalised so that the last nonzero coordinate is 1. To get coprime integer solutions just scale up.
sage: Pts = C.rational_points(bound=10)
sage: [P.clear_denominators() for P in Pts]
[None, None, None, None, None, None, None, None, None, None, None, None]
sage: Pts
[(-6 : -3 : 2),
(-2 : -2 : 1),
(-3 : -6 : 2),
(-2 : 6 : 3),
(-1 : 2 : 2),
(-2 : 3 : 6),
(0 : 0 : 1),
(0 : 1 : 0),
(3 : -2 : 6),
(2 : -1 : 2),
(1 : 0 : 0),
(6 : -2 : 3)]
Sun, 15 Dec 2013 07:31:06 +0100https://ask.sagemath.org/question/7888/finding-coprime-integer-solutions/?answer=15815#post-id-15815