Ask Your Question

Revision history [back]

The explanation is that solve_diophantine simply calls sympy's diophantine, which ignores all assumptions.

So you will have to filter manually:

sage: var('n,k')
sage: eqn = n^2 - (k^2 + k) == 30
sage: [(n0, k0) for (n0, k0) in solve_diophantine(eqn, (n,k)) if n0 > 0 and k0 > 0 and n0 > k0]
[(6, 2), (30, 29)]

Filtering could be added as a post-processing step in solve_diophantine, so you could open an issue for that.