ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 12 Jan 2015 09:47:00 -0600Factoring bivariate polynomials w.r.t. a single variablehttp://ask.sagemath.org/question/8155/factoring-bivariate-polynomials-wrt-a-single-variable/the function **factor()** works in this fashion:
sage: x, y = PolynomialRing(GF(17), 2, ['x','y']).gens()
sage: f = 9*y^6 - 9*x^2*y^5 - 18*x^3*y^4 - 9*x^5*y^4 + 9*x^6*y^2 + 9*x^7*y^3 + 18*x^8*y^2 - 9*x^11
sage: f.factor()
(-9) * (x^5 - y^2) * (x^6 - 2*x^3*y^2 - x^2*y^3 + y^4)
Is there a possibility to factorize a bivariate polynomial in x,y with respect to a single variable only (e.g. y) and get the answer in the form of **(y - f(x))** as factors? Thu, 09 Jun 2011 02:00:21 -0500http://ask.sagemath.org/question/8155/factoring-bivariate-polynomials-wrt-a-single-variable/Comment by John Cremona for <p>the function <strong>factor()</strong> works in this fashion:</p>
<pre><code>sage: x, y = PolynomialRing(GF(17), 2, ['x','y']).gens()
sage: f = 9*y^6 - 9*x^2*y^5 - 18*x^3*y^4 - 9*x^5*y^4 + 9*x^6*y^2 + 9*x^7*y^3 + 18*x^8*y^2 - 9*x^11
sage: f.factor()
(-9) * (x^5 - y^2) * (x^6 - 2*x^3*y^2 - x^2*y^3 + y^4)
</code></pre>
<p>Is there a possibility to factorize a bivariate polynomial in x,y with respect to a single variable only (e.g. y) and get the answer in the form of <strong>(y - f(x))</strong> as factors? </p>
http://ask.sagemath.org/question/8155/factoring-bivariate-polynomials-wrt-a-single-variable/?comment=21341#post-id-21341Surely there is no essential difference between the factorization in $F[x,y]$ which you see and the one in $F(x)[y]$ which you want, by Gauss's Lemma? The fact that none of the displayed factors is linear in $y$ just means that $f$ has no roots in $F(x)$ when you consider it as a polynomial in $F(x)[y]$. To get roots (and hence linear factors) you would need to enlarge $F(x)$ to its algebraic closure.Fri, 19 Aug 2011 03:24:11 -0500http://ask.sagemath.org/question/8155/factoring-bivariate-polynomials-wrt-a-single-variable/?comment=21341#post-id-21341Answer by MvG for <p>the function <strong>factor()</strong> works in this fashion:</p>
<pre><code>sage: x, y = PolynomialRing(GF(17), 2, ['x','y']).gens()
sage: f = 9*y^6 - 9*x^2*y^5 - 18*x^3*y^4 - 9*x^5*y^4 + 9*x^6*y^2 + 9*x^7*y^3 + 18*x^8*y^2 - 9*x^11
sage: f.factor()
(-9) * (x^5 - y^2) * (x^6 - 2*x^3*y^2 - x^2*y^3 + y^4)
</code></pre>
<p>Is there a possibility to factorize a bivariate polynomial in x,y with respect to a single variable only (e.g. y) and get the answer in the form of <strong>(y - f(x))</strong> as factors? </p>
http://ask.sagemath.org/question/8155/factoring-bivariate-polynomials-wrt-a-single-variable/?answer=25499#post-id-25499Try this:
sage: g = f.polynomial(y)
sage: g.change_ring(g.base_ring().fraction_field()).factor()
(9) * (y^2 + 16*x^5) * (y^4 + 16*x^2*y^3 + 15*x^3*y^2 + x^6)
I'm not sure whether that's any better than your original
sage: f.factor()
(-8) * (-x^5 + y^2) * (x^6 - 2*x^3*y^2 - x^2*y^3 + y^4)
since as John already indicated, there is no fundamental difference.Mon, 12 Jan 2015 09:47:00 -0600http://ask.sagemath.org/question/8155/factoring-bivariate-polynomials-wrt-a-single-variable/?answer=25499#post-id-25499Answer by radokirov for <p>the function <strong>factor()</strong> works in this fashion:</p>
<pre><code>sage: x, y = PolynomialRing(GF(17), 2, ['x','y']).gens()
sage: f = 9*y^6 - 9*x^2*y^5 - 18*x^3*y^4 - 9*x^5*y^4 + 9*x^6*y^2 + 9*x^7*y^3 + 18*x^8*y^2 - 9*x^11
sage: f.factor()
(-9) * (x^5 - y^2) * (x^6 - 2*x^3*y^2 - x^2*y^3 + y^4)
</code></pre>
<p>Is there a possibility to factorize a bivariate polynomial in x,y with respect to a single variable only (e.g. y) and get the answer in the form of <strong>(y - f(x))</strong> as factors? </p>
http://ask.sagemath.org/question/8155/factoring-bivariate-polynomials-wrt-a-single-variable/?answer=12453#post-id-12453This should do it
R = PolynomialRing(GF(17), 'x')
x = R.gens()[0]
y = PolynomialRing(R, 'y').gens()[0]
f = 9*y^6 - 9*x^2*y^5 - 18*x^3*y^4 - 9*x^5*y^4 + 9*x^6*y^2 + 9*x^7*y^3 + 18*x^8*y^2 - 9*x^11
f.factor()
Unfortunately, it seems that the functionality to factor over a generic polynomial ring is not implemented.Tue, 21 Jun 2011 16:57:50 -0500http://ask.sagemath.org/question/8155/factoring-bivariate-polynomials-wrt-a-single-variable/?answer=12453#post-id-12453