Ask Your Question

Revision history [back]

sage: R.<x> = PolynomialRing(GF(2))
sage: f = x^3 - 1
sage: g = x - 1
sage: f // g
x^2 + x + 1
sage: type(f // g)
<class 'sage.rings.polynomial.polynomial_gf2x.Polynomial_GF2X'>
sage: (f // g).parent() is R
True

Or if you have an element of the fraction field which you know has a unit in the denominator, you can convert:

sage: R(f / g)
x^2 + x + 1

sage: R.<x> = PolynomialRing(GF(2)) sage: f = x^3 - 1 sage: g = x - 1 sage: f // g x^2 + x + 1 sage: type(f // g) <class 'sage.rings.polynomial.polynomial_gf2x.Polynomial_GF2X'> 'sage.rings.polynomial.polynomial_gf2x.polynomial_gf2x'=""> sage: (f // g).parent() is R True

True

Or if you have an element of the fraction field which you know has equals a fraction with a unit in the denominator, you can convert:convert it into an element of R:

sage: R(f / g)
x^2 + x + 1

Like this:

sage: R.<x> = PolynomialRing(GF(2))
 sage: f = x^3 - 1
 sage: g = x - 1
 sage: f // g
 x^2 + x + 1
 sage: type(f // g)
 <class 'sage.rings.polynomial.polynomial_gf2x.polynomial_gf2x'="">
    'sage.rings.polynomial.polynomial_gf2x.Polynomial_GF2X'>
sage: (f // g).parent() is R
    True

True

Or if you have an element of the fraction field which equals a fraction with a unit in the denominator, you can convert it into an element of R:

sage: R(f / g)
x^2 + x + 1