Ask Your Question

Revision history [back]

Integers, or "Integers"?

My understanding is that the solve_diophantine() function is supposed to return only positive integers. However, the following code:

a,b,c = 2,3,5
x, k = var('x,k')
solve_diophantine(a*x^2 + b*x + c - k^2 == 0, (x,k))

returns (partial list):

[(-1/16*sqrt(2)*((470832*sqrt(2) + 665857)^t*(13*sqrt(2) + 20) + (-470832*sqrt(2) + 665857)^t*(13*sqrt(2) - 20)) - 3/4, 1/8*(470832*sqrt(2) + 665857)^t*(13*sqrt(2) + 20) - 1/8*(-470832*sqrt(2) + 665857)^t*(13*sqrt(2) - 20)), ...
(1/16*sqrt(2)*((470832*sqrt(2) + 665857)^t*(19*sqrt(2) + 28) + (-470832*sqrt(2) + 665857)^t*(19*sqrt(2) - 28)) - 3/4, -1/8*(470832*sqrt(2) + 665857)^t*(19*sqrt(2) + 28) + 1/8*(-470832*sqrt(2) + 665857)^t*(19*sqrt(2) - 28))]

And another 14 entries. All of the entries have the same $665857 \pm 470832 \sqrt 2$ as factors. Now, it turns out that $\sqrt 2 \approx \frac{665857}{470832}$ , out to 12 significant digits, a pretty impressive convergent, but... what is it doing in this output?

For reference, there are integer solutions at $(x,k) = (4,7); (19,28)$, and possibly (probably?) others. If I replace the equation with ax^2 + bx + c - 49 == 0, I get 4 as output.

Is there something I've failed to coerce, or something I need to import, or is this just something weird that Sage is doing?

(EDIT: Note that the pair $(19,28)$ appears in that last entry as a factor of $28 +19 \sqrt 2$. But none of the other solutions appear, just... other random covergents of $\sqrt 2$. Nor is $(470832, 665857)$ a solution.