AUTHORS:
REFERENCES:
Bases: sage.structure.element.FieldElement
EXAMPLES:
sage: K, x = FractionField(PolynomialRing(QQ, 'x')).objgen()
sage: K
Fraction Field of Univariate Polynomial Ring in x over Rational Field
sage: loads(K.dumps()) == K
True
sage: f = (x^3 + x)/(17 - x^19); f
(x^3 + x)/(-x^19 + 17)
sage: loads(f.dumps()) == f
True
TESTS:
Test if #5451 is fixed:
sage: A = FiniteField(9,'theta')['t']
sage: K.<t> = FractionField(A)
sage: f= 2/(t^2+2*t); g =t^9/(t^18 + t^10 + t^2);f+g
(2*t^15 + 2*t^14 + 2*t^13 + 2*t^12 + 2*t^11 + 2*t^10 + 2*t^9 + t^7 + t^6 + t^5 + t^4 + t^3 + t^2 + t + 1)/(t^17 + t^9 + t)
Test if #8671 is fixed:
sage: P.<n> = QQ[]
sage: F = P.fraction_field()
sage: P.one_element()//F.one_element()
1
sage: F.one_element().quo_rem(F.one_element())
(1, 0)
EXAMPLES:
sage: R.<x,y> = ZZ[]
sage: f = x/y+1; f
(x + y)/y
sage: f.denominator()
y
Returns True if this element is equal to one.
EXAMPLES:
sage: F = ZZ['x,y'].fraction_field()
sage: x,y = F.gens()
sage: (x/x).is_one()
True
sage: (x/y).is_one()
False
Returns whether or not self is a perfect square. If the optional argument root is True, then also returns a square root (or None, if the fraction field element is not square).
INPUT:
OUTPUT:
EXAMPLES:
sage: R.<t> = QQ[]
sage: (1/t).is_square()
False
sage: (1/t^6).is_square()
True
sage: ((1+t)^4/t^6).is_square()
True
sage: (4*(1+t)^4/t^6).is_square()
True
sage: (2*(1+t)^4/t^6).is_square()
False
sage: ((1+t)/t^6).is_square()
False
sage: (4*(1+t)^4/t^6).is_square(root=True)
(True, (2*t^2 + 4*t + 2)/t^3)
sage: (2*(1+t)^4/t^6).is_square(root=True)
(False, None)
sage: R.<x> = QQ[]
sage: a = 2*(x+1)^2 / (2*(x-1)^2); a
(2*x^2 + 4*x + 2)/(2*x^2 - 4*x + 2)
sage: a.numerator().is_square()
False
sage: a.is_square()
True
sage: (0/x).is_square()
True
Returns True if this element is equal to zero.
EXAMPLES:
sage: F = ZZ['x,y'].fraction_field()
sage: x,y = F.gens()
sage: t = F(0)/x
sage: t.is_zero()
True
sage: u = 1/x - 1/x
sage: u.is_zero()
True
sage: u.parent() is F
True
EXAMPLES:
sage: R.<x,y> = ZZ[]
sage: f = x/y+1; f
(x + y)/y
sage: f.numerator()
x + y
Divides out the gcd of the numerator and denominator.
Automatically called for exact rings, but because it may be numerically unstable for inexact rings it must be called manually in that case.
EXAMPLES:
sage: R.<x> = RealField(10)[]
sage: f = (x^2+2*x+1)/(x+1); f
(x^2 + 2.0*x + 1.0)/(x + 1.0)
sage: f.reduce(); f
x + 1.0
Return the valuation of self, assuming that the numerator and denominator have valuation functions defined on them.
EXAMPLES:
sage: x = PolynomialRing(RationalField(),'x').gen()
sage: f = (x^3 + x)/(x^2 - 2*x^3)
sage: f
(x^2 + 1)/(-2*x^2 + x)
sage: f.valuation()
-1
sage: f.valuation(x^2+1)
1
Bases: sage.rings.fraction_field_element.FractionFieldElement
A fraction field element where the parent is the fraction field of a univariate polynomial ring.
Many of the functions here are included for coherence with number fields.
Returns whether this element is actually a polynomial.
EXAMPLES:
sage: R.<t> = GF(5)[]
sage: K = R.fraction_field
Returns a sorted list of primes dividing either the numerator or denominator of this element.
EXAMPLES:
sage: R.<t> = QQ[]
sage: h = (t^14 + 2*t^12 - 4*t^11 - 8*t^9 + 6*t^8 + 12*t^6 - 4*t^5 - 8*t^3 + t^2 + 2)/(t^6 + 6*t^5 + 9*t^4 - 2*t^2 - 12*t - 18)
sage: h.support()
[t - 1, t + 3, t^2 + 2, t^2 + t + 1, t^4 - 2]
Returns whether or not x is of type FractionFieldElement.
EXAMPLES:
sage: from sage.rings.fraction_field_element import is_FractionFieldElement
sage: R.<x> = ZZ[]
sage: is_FractionFieldElement(x/2)
False
sage: is_FractionFieldElement(2/x)
True
sage: is_FractionFieldElement(1/3)
False
Used for unpickling FractionFieldElement objects (and subclasses).
EXAMPLES:
sage: from sage.rings.fraction_field_element import make_element
sage: R = ZZ['x,y']
sage: x,y = R.gens()
sage: F = R.fraction_field()
sage: make_element(F, 1+x, 1+y)
(x + 1)/(y + 1)
Used for unpickling old FractionFieldElement pickles.
EXAMPLES:
sage: from sage.rings.fraction_field_element import make_element_old
sage: R.<x,y> = ZZ[]
sage: F = R.fraction_field()
sage: make_element_old(F, {'_FractionFieldElement__numerator':x+y,'_FractionFieldElement__denominator':x-y})
(x + y)/(x - y)