Module: sage.rings.fraction_field
Fraction Field of Integral Domains
Author: William Stein (with input from David Joyner, David Kohel, and Joe Wetherell)
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
Module-level Functions
R, [names=None]) |
Create the fraction field of the integral domain R.
Input:
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)) Traceback (most recent call last): ... TypeError: R must be an integral domain.
x) |
Class: FractionField_generic
self, R) |
Create the fraction field of the integral domain R.
Input:
sage: Frac(QQ['x']) Fraction Field of Univariate Polynomial Ring in x over Rational Field sage: Frac(QQ['x,y']).variable_names() ('x', 'y')
Functions: base_ring,
characteristic,
construction,
gen,
is_exact,
is_field,
ngens,
ring
self) |
Return the base ring of self; this is the base ring of the ring which this fraction field is the fraction field of.
sage: R = Frac(ZZ['t']) sage: R.base_ring() Integer Ring
self) |
Return the characteristic of this fraction field.
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
self, [i=0]) |
Return the ith generator of self.
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
self) |
sage: Z.<z>=CC[] sage: Z.is_exact() False
self) |
Returns True, since the fraction field is a field.
sage: Frac(ZZ).is_field() True
self) |
This is the same as for the parent object.
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
self) |
Return the ring that this is the fraction field of.
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
Special Functions: __call__,
__cmp__,
__init__,
__repr__,
_coerce_impl,
_latex_,
_magma_,
_magma_init_
self, x) |
Return the canonical coercion of x into this fraction field, or raise a TypeError.
The rings that canonically coerce to the fraction field are * the fraction field itself * any fraction field that of the form Frac(S) where S canonically coerces to this ring. * any ring that canonically coerces to the ring R such that this fraction field is Frac(R)
self, [magma=None]) |
sage: magma(QQ['x,y'].fraction_field()) #optional Multivariate rational function field of rank 2 over Rational Field Variables: x, y
sage: magma(ZZ['x'].fraction_field()) #optional Univariate rational function field over Integer Ring Variables: x
self) |
Return a string representation of self Magma can understand.
sage: QQ['x'].fraction_field()._magma_init_() 'FieldOfFractions(PolynomialRing(RationalField()))'