With sympy version 1.5.1:

from sympy import *
from sympy.solvers.diophantine import diop_quadratic

a, b, x, y = symbols('a b x y', integer=True, positive=True)
f = -a*x + x**2 - b*y + y**2
g = f.subs([(a, 15), (b, 8)])
print('diophantine   (', g, ') solutions:', diophantine(g))
print('diop_quadratic(', g, ') solutions:', diop_quadratic(g))
h = f.subs([(a, 8), (b, 15)])
print('diophantine   (', h, ') solutions:', diophantine(h))
print('diop_quadratic(', h, ') solutions:', diop_quadratic(h))
print(g.subs([(x, 16), (y, 4)]))

Output:

diophantine   ( x**2 - 15*x + y**2 - 8*y ) solutions: {(15, 8)}
diop_quadratic( x**2 - 15*x + y**2 - 8*y ) solutions: {(15, 0), (0, 8), 
(15, 8), (0, 0)}
diophantine   ( x**2 - 8*x + y**2 - 15*y ) solutions: {(8, 15), (4, 16)}
diop_quadratic( x**2 - 8*x + y**2 - 15*y ) solutions: {(0, 0), (0, 15), (8, 
0), (4, 16), (4, -1), (8, 15)}
0

First, I expect diophantine() to return the same solutions as 
diop_quadratic(), but it doesn't.

Second, the function f() is symmetric in x and y, so the solutions to g() 
and h() should be symmetric, but they aren't.  For example, (16, 4) is a 
solution to g(), but is missing from the solution set.

Am I misunderstanding something, or are these bugs?

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/867f3b5f-06dd-44a1-94ca-2c726cd8dc61%40googlegroups.com.

Reply via email to