1 | initial version |
The two methods use different approaches under the hood. The second method computes the factorization of the polynomial over $\mathbb{Z}$. Then the integral roots belong to the linear factors in this factorization.
The third method uses Sympy's univariate diophantine equation solver which apparently first computes the real solutions and then determines which of them are integral. This seems to be hard for Sympy in your example in which it calculates
Intersection(FiniteSet(-1/3 - 2/(9*(2707/54 + 11*sqrt(6729)/18)**(1/3)) + (2707/54 + 11*sqrt(6729)/18)**(1/3)), Integers)
and probably lacks the proper support for dealing well with elements of algebraic number fields (my guess)...
You can find this out by stopping the calculation with a keyboard interrupt (Ctrl-C
) and looking at the stack trace; or by directly going through Sage's source code (and then Sympy's).