Ask Your Question

Revision history [back]

assume() not playing well with solve_diophantine()

Simple code:

var('n k')
assume(n > 0)
assume(k > 0)
assume(n > k)

eqn = n^2 - (k^2 + k) == 30
print(solve_diophantine(eqn, (n,k)))

This outputs:

[(30, -30), (-6, 2), (-6, -3), (6, 2), (6, -3), (-30, 29), (-30, -30), (30, 29)]

which contains solutions where each of the assumptions is skipped (including at least one where all three assumptions are not met). Can anyone help explain what might be happening here?