Fraction Field of Integral Domains

AUTHORS:

  • William Stein (with input from David Joyner, David Kohel, and Joe Wetherell)
  • Burcin Erocal

EXAMPLES:

Quotienting is a constructor for an element of the fraction field:

sage: R.<x> = QQ[]
sage: (x^2-1)/(x+1)
x - 1
sage: parent((x^2-1)/(x+1))
Fraction Field of Univariate Polynomial Ring in x over Rational Field

The GCD is not taken (since it doesn’t converge sometimes) in the inexact case.

sage: Z.<z> = CC[]
sage: I = CC.gen()
sage: (1+I+z)/(z+0.1*I)
(1.00000000000000*z + 1.00000000000000 + 1.00000000000000*I)/(1.00000000000000*z + 0.100000000000000*I)
sage: (1+I*z)/(z+1.1)
(1.00000000000000*I*z + 1.00000000000000)/(1.00000000000000*z + 1.10000000000000)

TESTS:

sage: F = FractionField(IntegerRing())
sage: F == loads(dumps(F))
True
sage: F = FractionField(PolynomialRing(RationalField(),'x'))
sage: F == loads(dumps(F))
True
sage: F = FractionField(PolynomialRing(IntegerRing(),'x'))
sage: F == loads(dumps(F))
True
sage: F = FractionField(PolynomialRing(RationalField(),2,'x'))
sage: F == loads(dumps(F))
True
sage.rings.fraction_field.FractionField(R, names=None)

Create the fraction field of the integral domain R.

INPUT:

  • R - an integral domain
  • names - ignored

EXAMPLES: We create some example fraction fields.

sage: FractionField(IntegerRing())
Rational Field
sage: FractionField(PolynomialRing(RationalField(),'x'))
Fraction Field of Univariate Polynomial Ring in x over Rational Field
sage: FractionField(PolynomialRing(IntegerRing(),'x'))
Fraction Field of Univariate Polynomial Ring in x over Integer Ring
sage: FractionField(PolynomialRing(RationalField(),2,'x'))
Fraction Field of Multivariate Polynomial Ring in x0, x1 over Rational Field

Dividing elements often implicitly creates elements of the fraction field.

sage: x = PolynomialRing(RationalField(), 'x').gen()
sage: f = x/(x+1)
sage: g = x**3/(x+1)
sage: f/g
1/x^2
sage: g/f
x^2

The input must be an integral domain.

sage: Frac(Integers(4))
...
TypeError: R must be an integral domain.
class sage.rings.fraction_field.FractionField_generic(R, element_class=<type 'sage.rings.fraction_field_element.FractionFieldElement'>)

The fraction field of an integral domain.

__cmp__(other)

EXAMPLES:

sage: Frac(ZZ['x']) == Frac(ZZ['x'])
True
sage: Frac(ZZ['x']) == Frac(QQ['x'])
False
sage: Frac(ZZ['x']) == Frac(ZZ['y'])
False
sage: Frac(ZZ['x']) == QQ['x']
False
__init__(R, element_class=<type 'sage.rings.fraction_field_element.FractionFieldElement'>)

Create the fraction field of the integral domain R.

INPUT:

  • R - an integral domain

EXAMPLES:

sage: Frac(QQ['x'])
Fraction Field of Univariate Polynomial Ring in x over Rational Field
sage: Frac(QQ['x,y']).variable_names()
('x', 'y')
__reduce__()

TESTS:

sage: K = Frac(QQ['x'])
sage: loads(dumps(K)) is K
True
_coerce_map_from_(S)

Returns True if elements of S can be coerced into this fraction field.

This fraction field has coercions from:

  • itself
  • any fraction field where the base ring coerces to the base ring of this fraction field
  • any ring that coerces to the base ring of this fraction field

EXAMPLES:

sage: F = QQ['x,y'].fraction_field()
sage: F.has_coerce_map_from(F)
True
sage: F.has_coerce_map_from(ZZ['x,y'].fraction_field())
True
sage: F.has_coerce_map_from(ZZ['x,y,z'].fraction_field())
False
sage: F.has_coerce_map_from(ZZ)
True

Test coercions:

sage: F.coerce(1)
1
sage: F.coerce(int(1))
1
sage: F.coerce(1/2)
1/2
sage: K = ZZ['x,y'].fraction_field()
sage: x,y = K.gens()
sage: F.coerce(F.gen())
x
sage: F.coerce(x)
x
sage: F.coerce(x/y)
x/y
sage: L = ZZ['x'].fraction_field()
sage: K.coerce(L.gen())
x
_element_constructor_(x, coerce=True)

Construct an element of this fraction field.

EXAMPLES:

sage: F = QQ['x,y'].fraction_field()
sage: F._element_constructor_(1)
1
sage: F._element_constructor_(F.gen(0)/F.gen(1))
x/y
sage: K = ZZ['x,y'].fraction_field()
sage: x,y = K.gens()
sage: F._element_constructor_(x/y)
x/y
_is_valid_homomorphism_(codomain, im_gens)

Check if the homomorphism defined by sending generators of this fraction field to im_gens in codomain is valid.

EXAMPLES:

sage: F = QQ['x,y'].fraction_field()
sage: x,y = F.gens()
sage: F._is_valid_homomorphism_(F, [y,x])
True
sage: R = ZZ['x']; x = R.gen()
sage: F._is_valid_homomorphism_(R, [x, x])
False

TESTS:

sage: F._is_valid_homomorphism_(ZZ, [])
False

Test homomorphisms:

sage: phi = F.hom([2*y, x])
sage: phi(x+y)
x + 2*y
sage: phi(x/y)
2*y/x
_latex_()

EXAMPLES:

sage: latex(Frac(GF(7)['x,y,z']))
\mathrm{Frac}(\Bold{F}_{7}[x, y, z])
_magma_init_(magma)

Return a string representation of self in the given magma instance.

EXAMPLES:

sage: QQ['x'].fraction_field()._magma_init_(magma)            # optional - magma
'SageCreateWithNames(FieldOfFractions(SageCreateWithNames(PolynomialRing(_sage_ref...),["x"])),["x"])'
sage: GF(9,'a')['x,y,z'].fraction_field()._magma_init_(magma) # optional - magma
'SageCreateWithNames(FieldOfFractions(SageCreateWithNames(PolynomialRing(_sage_ref...,3,"grevlex"),["x","y","z"])),["x","y","z"])'

_magma_init_ gets called implicitly below.

sage: magma(QQ['x,y'].fraction_field())                  # optional - magma
Multivariate rational function field of rank 2 over Rational Field
Variables: x, y
sage: magma(ZZ['x'].fraction_field())                    # optional - magma
Univariate rational function field over Integer Ring
Variables: x

Verify that conversion is being properly cached:

sage: k = Frac(QQ['x,z'])                                # optional - magma
sage: magma(k) is magma(k)                               # optional - magma
True
_repr_()

EXAMPLES:

sage: str(Frac(ZZ['x']))
'Fraction Field of Univariate Polynomial Ring in x over Integer Ring'
base_ring()

Return the base ring of self; this is the base ring of the ring which this fraction field is the fraction field of.

EXAMPLES:

sage: R = Frac(ZZ['t']) 
sage: R.base_ring()
Integer Ring
characteristic()

Return the characteristic of this fraction field.

EXAMPLES:

sage: R = Frac(ZZ['t']) 
sage: R.base_ring()
Integer Ring
sage: R = Frac(ZZ['t']); R.characteristic()
0
sage: R = Frac(GF(5)['w']); R.characteristic()
5
construction()

EXAMPLES:

sage: Frac(ZZ['x']).construction()
(FractionField, Univariate Polynomial Ring in x over Integer Ring)
sage: K = Frac(GF(3)['t'])
sage: f, R = K.construction()
sage: f(R)
Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 3
sage: f(R) == K
True
gen(i=0)

Return the ith generator of self.

EXAMPLES:

sage: R = Frac(PolynomialRing(QQ,'z',10)); R
Fraction Field of Multivariate Polynomial Ring in z0, z1, z2, z3, z4, z5, z6, z7, z8, z9 over Rational Field
sage: R.0
z0
sage: R.gen(3)
z3
sage: R.3
z3
is_exact()

EXAMPLES:

sage: Frac(ZZ['x']).is_exact()
True
sage: Frac(CDF['x']).is_exact()
False
is_field()

Returns True, since the fraction field is a field.

EXAMPLES:

sage: Frac(ZZ).is_field()
True
ngens()

This is the same as for the parent object.

EXAMPLES:

sage: R = Frac(PolynomialRing(QQ,'z',10)); R
Fraction Field of Multivariate Polynomial Ring in z0, z1, z2, z3, z4, z5, z6, z7, z8, z9 over Rational Field
sage: R.ngens()
10
random_element(*args, **kwds)

Returns a random element in this fraction field.

EXAMPLES:

sage: F = ZZ['x'].fraction_field()
sage: F.random_element()
(2*x - 8)/(-x^2 + x)
sage: F.random_element(degree=5)
(-12*x^5 - 2*x^4 - x^3 - 95*x^2 + x + 2)/(-x^5 + x^4 - x^3 + x^2)
ring()

Return the ring that this is the fraction field of.

EXAMPLES:

sage: R = Frac(QQ['x,y'])
sage: R
Fraction Field of Multivariate Polynomial Ring in x, y over Rational Field
sage: R.ring()
Multivariate Polynomial Ring in x, y over Rational Field
sage.rings.fraction_field.is_FractionField(x)

Tests whether or not x inherits from FractionField_generic.

EXAMPLES:

sage: from sage.rings.fraction_field import is_FractionField
sage: is_FractionField(Frac(ZZ['x']))
True
sage: is_FractionField(QQ)
False

Previous topic

Infinity Rings

Next topic

Fraction Field Elements

This Page