2013/10/4 Jori Mantysalo <jori.mantys...@uta.fi>

> On Fri, 4 Oct 2013, Volker Braun wrote:
>
>  If the integral polynomial is not monic then the roots need not be
>> integral:
>>
>> sage: R.<x> = QQ[]
>> sage: (4*x^2-1).factor()
>> (4) * (x - 1/2) * (x + 1/2)
>>
>
(4*x^2-1) = (2*x-1)*(2*x+1)

ZZ[x] has unique factorization, and so does ZZ[x,y], and so does any
multivariate polynomial ring over ZZ. Indeed, for any UFD R, the polynomial
ring R[x] is again a UFD, hence by induction so are multivariate polynomial
rings.



>
>> So this would not be factorizable in ZZ[x] but is factorizable in QQ[x]
>>
>
> Of course. Duh.
>
> Anyways, is this possible path to (non-optimal) solution? Factor in QQ,
> get parts that are not integral polynomials and multiply them to get
> integral parts? It would of course be quite slow if polynomial happens to
> have many factors that must be check to find integral-producing products.


Just take the factorization over QQ, then for each factor, make it a
primitive integral polynomial, i.e., multiply by the lcm of the
denominators of the coefficients and divide by the gcd of the numerators of
the coefficients. Then you have a factorization into irreducible integral
polynomials times some integer, factor that integer and you have the
complete factorization over ZZ.

The only part that can be slow is the factorization of the integer in the
end, the rest is very fast. It just requires a little bit more programming
than what you wrote before.


>
>
> --
> Jori Mäntysalo
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 
> sage-devel+unsubscribe@**googlegroups.com<sage-devel%2bunsubscr...@googlegroups.com>
> .
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at 
> http://groups.google.com/**group/sage-devel<http://groups.google.com/group/sage-devel>
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to