ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 06 Jun 2020 01:06:36 +0200Factorization/Irreducibility of multivariate polynomials over function fieldshttps://ask.sagemath.org/question/51769/factorizationirreducibility-of-multivariate-polynomials-over-function-fields/I want to do this:
L.<t> = FunctionField(GF(5))
R.<x,y> = PolynomialRing(L)
p = x^2-t^2*y^2
p.factor()
As a result, I would like to get something like `(x+t*y)(x-t*y)` or `(x+t*y)(x+4*t*y)`.
But what I get is:
sage: L.<t> = FunctionField(GF(5))
/software/sagemath/9.0/SageMath/local/lib/python3.7/site-packages/sage/rings/function_field/ideal.py:2217: DeprecationWarning: invalid escape sequence \g
"""
sage: R.<x,y> = PolynomialRing(L)
sage: p = x^2-t^2*y^2
sage: p.factor()
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
<ipython-input-5-f448610e9d77> in <module>()
----> 1 p.factor()
/software/sagemath/9.0/SageMath/local/lib/python3.7/site-packages/sage/rings/polynomial/multi_polynomial_element.py in factor(self, proof)
1842 proof = get_flag(subsystem="polynomial")
1843 if proof:
-> 1844 raise NotImplementedError("Provably correct factorization not implemented. Disable this error by wrapping your code in a `with proof.WithProof('polynomial', False):` block.")
1845
1846 R._singular_().set_ring()
NotImplementedError: Provably correct factorization not implemented. Disable this error by wrapping your code in a `with proof.WithProof('polynomial', False):` block.
However, this works, but (as already indicated in the parentheses) I get a wrong result:
sage: p.factor(false)
[(x + t*y, 1), (-x + t*y, 1)]
Unlike the univariate case, there is also no option to check whether the polynomial is irreducible, i.e. `p.is_irreducible()` doesn't exist.
Fri, 05 Jun 2020 09:41:45 +0200https://ask.sagemath.org/question/51769/factorizationirreducibility-of-multivariate-polynomials-over-function-fields/Answer by dan_fulea for <p>I want to do this:</p>
<pre><code>L.<t> = FunctionField(GF(5))
R.<x,y> = PolynomialRing(L)
p = x^2-t^2*y^2
p.factor()
</code></pre>
<p>As a result, I would like to get something like <code>(x+t*y)(x-t*y)</code> or <code>(x+t*y)(x+4*t*y)</code>.</p>
<p>But what I get is:</p>
<pre><code>sage: L.<t> = FunctionField(GF(5))
/software/sagemath/9.0/SageMath/local/lib/python3.7/site-packages/sage/rings/function_field/ideal.py:2217: DeprecationWarning: invalid escape sequence \g
"""
sage: R.<x,y> = PolynomialRing(L)
sage: p = x^2-t^2*y^2
sage: p.factor()
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
<ipython-input-5-f448610e9d77> in <module>()
----> 1 p.factor()
/software/sagemath/9.0/SageMath/local/lib/python3.7/site-packages/sage/rings/polynomial/multi_polynomial_element.py in factor(self, proof)
1842 proof = get_flag(subsystem="polynomial")
1843 if proof:
-> 1844 raise NotImplementedError("Provably correct factorization not implemented. Disable this error by wrapping your code in a `with proof.WithProof('polynomial', False):` block.")
1845
1846 R._singular_().set_ring()
NotImplementedError: Provably correct factorization not implemented. Disable this error by wrapping your code in a `with proof.WithProof('polynomial', False):` block.
</code></pre>
<p>However, this works, but (as already indicated in the parentheses) I get a wrong result:</p>
<pre><code>sage: p.factor(false)
[(x + t*y, 1), (-x + t*y, 1)]
</code></pre>
<p>Unlike the univariate case, there is also no option to check whether the polynomial is irreducible, i.e. <code>p.is_irreducible()</code> doesn't exist.</p>
https://ask.sagemath.org/question/51769/factorizationirreducibility-of-multivariate-polynomials-over-function-fields/?answer=51775#post-id-51775This is not really an answer to the stated question, but mathematically would lead to the solution. Assume we want to factorize the expression:
$$
E = x^3+y^3-\frac 1{t^3}-2\frac{xy}t
$$
defined (strictly speaking) over $\Bbb F_5(t)[x,y]$. Well, we ignore this pedant choice of the ring of definition of $E$, and work in the ring (of fractions, without really introducing it,) generated over $\Bbb F_5$ by $x,y,z$. We build numerator and denominator, and ask for a factorization in this ring.
R.<t,x,y> = PolynomialRing(GF(5))
E = x^3 +y^3 -1/t^3 -2*x*y/t
den = E.denominator()
num = E.numerator()
print( "Is E = num/den? {}".format(E == num/den) )
print( "num = {}".format( num.factor() ) )
print( "den = {}".format( den.factor() ) )
This gives after a copy+paste into the sage-ipython interpreter:
sage:
....: R.<t,x,y> = PolynomialRing(GF(5))
....: E = x^3 +y^3 -1/t^3 -2*x*y/t
....: den = E.denominator()
....: num = E.numerator()
....: print( "Is E = num/den? {}".format(E == num/den) )
....: print( "num = {}".format( num.factor() ) )
....: print( "den = {}".format( den.factor() ) )
....:
Is E = num/den? True
num = (t*x + t*y - 1) * (t^2*x^2 - t^2*x*y + t^2*y^2 + t*x + t*y + 1)
den = t^3
With the given polynomials (no denominator) things are even simpler...
sage: factor(x^2 - t^2*y^2)
(-1) * (t*y - x) * (t*y + x)
sage: factor(x^9 - t^6*y^3)
(-1) * (-x^3 + t^2*y) * (x^6 + t^2*x^3*y + t^4*y^2)
The main reason for the complications introduced by "intermediate rings or fields" is that some methods are not provided, but they are needed for a specific purpose. My strategy is to try to construct "in one breath" an algebraic structure where all expressions may live, then possibly work hard inside to mimic all i need. The same applies for instance when dealing with tower of fields. Sometimes is (and it definitively often was) hard to work in $\Bbb Q(\alpha)(\beta)$, where $\alpha, \beta$ are algebraic numbers, constructed as double extension of fields, but often we know (or find) a $\gamma$ with $\Bbb Q(\alpha)(\beta)=\Bbb Q(\gamma)$, (or construct $\Bbb Q(\alpha)(\beta)$, ask for a generator, and its minimal polynomial,) so build first $\Bbb Q(\gamma)$, then ask for the roots of the minimal polynomials of $\alpha,\beta$ in this field, and make specific choices. Of course, programatically it is easier to say "sage, give me the extension of $\Bbb Q$ with the minimal polynomial... (of $\alpha$), and then extend it further with the minimal polynomial... (of $\beta$)", but we get a field with methods that may fail when going in the depth. A lot of holes were covered the last years, this is the benefit of working in a strong, hard-working community, but there still are some.
The situation in the OP is completely different, but the reason for steping into unimplemented methods is the same. Having access to the code, one can always extend the class for the own needs.Sat, 06 Jun 2020 01:06:36 +0200https://ask.sagemath.org/question/51769/factorizationirreducibility-of-multivariate-polynomials-over-function-fields/?answer=51775#post-id-51775