# Revision history [back]

This 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.