Univariate rational functions over prime fields#

class sage.rings.fraction_field_FpT.FpT(R, names=None)#

This class represents the fraction field GF(p)(T) for $$2 < p < \sqrt{2^31-1}$$.

EXAMPLES:

sage: R.<T> = GF(71)[]
sage: K = FractionField(R); K
Fraction Field of Univariate Polynomial Ring in T over Finite Field of size 71
sage: 1-1/T
(T + 70)/T
sage: parent(1-1/T) is K
True

iter(bound=None, start=None)#

EXAMPLES:

sage: from sage.rings.fraction_field_FpT import *
sage: R.<t> = FpT(GF(5)['t'])
sage: list(R.iter(2))[350:355]
[(t^2 + t + 1)/(t + 2),
(t^2 + t + 2)/(t + 2),
(t^2 + t + 4)/(t + 2),
(t^2 + 2*t + 1)/(t + 2),
(t^2 + 2*t + 2)/(t + 2)]

class sage.rings.fraction_field_FpT.FpTElement#

An element of an FpT fraction field.

denom()#

Return the denominator of this element, as an element of the polynomial ring.

EXAMPLES:

sage: K = GF(11)['t'].fraction_field()
sage: t = K.gen(0); a = (t + 1/t)^3 - 1
sage: a.denom()
t^3

denominator()#

Return the denominator of this element, as an element of the polynomial ring.

EXAMPLES:

sage: K = GF(11)['t'].fraction_field()
sage: t = K.gen(0); a = (t + 1/t)^3 - 1
sage: a.denominator()
t^3

factor()#

EXAMPLES:

sage: K = Frac(GF(5)['t'])
sage: t = K.gen()
sage: f = 2 * (t+1) * (t^2+t+1)^2 / (t-1)
sage: factor(f)
(2) * (t + 4)^-1 * (t + 1) * (t^2 + t + 1)^2

is_square()#

Return True if this element is the square of another element of the fraction field.

EXAMPLES:

sage: K = GF(13)['t'].fraction_field(); t = K.gen()
sage: t.is_square()
False
sage: (1/t^2).is_square()
True
sage: K(0).is_square()
True

next()#

This function iterates through all polynomials, returning the “next” polynomial after this one.

The strategy is as follows:

• We always leave the denominator monic.

• We progress through the elements with both numerator and denominator monic, and with the denominator less than the numerator. For each such, we output all the scalar multiples of it, then all of the scalar multiples of its inverse.

• So if the leading coefficient of the numerator is less than p-1, we scale the numerator to increase it by 1.

• Otherwise, we consider the multiple with numerator and denominator monic.

• If the numerator is less than the denominator (lexicographically), we return the inverse of that element.

• If the numerator is greater than the denominator, we invert, and then increase the numerator (remaining monic) until we either get something relatively prime to the new denominator, or we reach the new denominator. In this case, we increase the denominator and set the numerator to 1.

EXAMPLES:

sage: from sage.rings.fraction_field_FpT import *
sage: R.<t> = FpT(GF(3)['t'])
sage: a = R(0)
sage: for _ in range(30):
....:     a = a.next()
....:     print(a)
1
2
1/t
2/t
t
2*t
1/(t + 1)
2/(t + 1)
t + 1
2*t + 2
t/(t + 1)
2*t/(t + 1)
(t + 1)/t
(2*t + 2)/t
1/(t + 2)
2/(t + 2)
t + 2
2*t + 1
t/(t + 2)
2*t/(t + 2)
(t + 2)/t
(2*t + 1)/t
(t + 1)/(t + 2)
(2*t + 2)/(t + 2)
(t + 2)/(t + 1)
(2*t + 1)/(t + 1)
1/t^2
2/t^2
t^2
2*t^2

numer()#

Return the numerator of this element, as an element of the polynomial ring.

EXAMPLES:

sage: K = GF(11)['t'].fraction_field()
sage: t = K.gen(0); a = (t + 1/t)^3 - 1
sage: a.numer()
t^6 + 3*t^4 + 10*t^3 + 3*t^2 + 1

numerator()#

Return the numerator of this element, as an element of the polynomial ring.

EXAMPLES:

sage: K = GF(11)['t'].fraction_field()
sage: t = K.gen(0); a = (t + 1/t)^3 - 1
sage: a.numerator()
t^6 + 3*t^4 + 10*t^3 + 3*t^2 + 1

sqrt(extend=True, all=False)#

Return the square root of this element.

INPUT:

• extend - bool (default: True); if True, return a square root in an extension ring, if necessary. Otherwise, raise a ValueError if the square is not in the base ring.

• all - bool (default: False); if True, return all square roots of self, instead of just one.

EXAMPLES:

sage: from sage.rings.fraction_field_FpT import *
sage: K = GF(7)['t'].fraction_field(); t = K.gen(0)
sage: p = (t + 2)^2/(3*t^3 + 1)^4
sage: p.sqrt()
(3*t + 6)/(t^6 + 3*t^3 + 4)
sage: p.sqrt()^2 == p
True

subs(*args, **kwds)#

EXAMPLES:

sage: K = Frac(GF(11)['t'])
sage: t = K.gen()
sage: f = (t+1)/(t-1)
sage: f.subs(t=2)
3
sage: f.subs(X=2)
(t + 1)/(t + 10)

valuation(v)#

Return the valuation of self at $$v$$.

EXAMPLES:

sage: R.<t> = GF(5)[]
sage: f = (t+1)^2 * (t^2+t+1) / (t-1)^3
sage: f.valuation(t+1)
2
sage: f.valuation(t-1)
-3
sage: f.valuation(t)
0

class sage.rings.fraction_field_FpT.FpT_Fp_section#

This class represents the section from GF(p)(t) back to GF(p)[t]

EXAMPLES:

sage: R.<t> = GF(5)[]
sage: K = R.fraction_field()
sage: f = GF(5).convert_map_from(K); f
Section map:
From: Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
To:   Finite Field of size 5
sage: type(f)
<class 'sage.rings.fraction_field_FpT.FpT_Fp_section'>


Warning

Comparison of FpT_Fp_section objects is not currently implemented. See trac ticket #23469.

sage: fprime = loads(dumps(f))
sage: fprime == f
False

sage: fprime(3) == f(3)
True

class sage.rings.fraction_field_FpT.FpT_Polyring_section#

This class represents the section from GF(p)(t) back to GF(p)[t]

EXAMPLES:

sage: R.<t> = GF(5)[]
sage: K = R.fraction_field()
sage: f = R.convert_map_from(K); f
Section map:
From: Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
To:   Univariate Polynomial Ring in t over Finite Field of size 5
sage: type(f)
<class 'sage.rings.fraction_field_FpT.FpT_Polyring_section'>


Warning

Comparison of FpT_Polyring_section objects is not currently implemented. See trac ticket #23469.

sage: fprime = loads(dumps(f))
sage: fprime == f
False

sage: fprime(1+t) == f(1+t)
True

class sage.rings.fraction_field_FpT.FpT_iter#

Bases: object

Return a class that iterates over all elements of an FpT.

EXAMPLES:

sage: K = GF(3)['t'].fraction_field()
sage: I = K.iter(1)
sage: list(I)
[0,
1,
2,
t,
t + 1,
t + 2,
2*t,
2*t + 1,
2*t + 2,
1/t,
2/t,
(t + 1)/t,
(t + 2)/t,
(2*t + 1)/t,
(2*t + 2)/t,
1/(t + 1),
2/(t + 1),
t/(t + 1),
(t + 2)/(t + 1),
2*t/(t + 1),
(2*t + 1)/(t + 1),
1/(t + 2),
2/(t + 2),
t/(t + 2),
(t + 1)/(t + 2),
2*t/(t + 2),
(2*t + 2)/(t + 2)]

class sage.rings.fraction_field_FpT.Fp_FpT_coerce#

This class represents the coercion map from GF(p) to GF(p)(t)

EXAMPLES:

sage: R.<t> = GF(5)[]
sage: K = R.fraction_field()
sage: f = K.coerce_map_from(GF(5)); f
Ring morphism:
From: Finite Field of size 5
To:   Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
sage: type(f)
<class 'sage.rings.fraction_field_FpT.Fp_FpT_coerce'>

section()#

Return the section of this inclusion: the partially defined map from GF(p)(t) back to GF(p), defined on constant elements.

EXAMPLES:

sage: R.<t> = GF(5)[]
sage: K = R.fraction_field()
sage: f = K.coerce_map_from(GF(5))
sage: g = f.section(); g
Section map:
From: Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
To:   Finite Field of size 5
sage: t = K.gen()
sage: g(f(1,3,reduce=False))
2
sage: g(t)
Traceback (most recent call last):
...
ValueError: not constant
sage: g(1/t)
Traceback (most recent call last):
...
ValueError: not integral

class sage.rings.fraction_field_FpT.Polyring_FpT_coerce#

This class represents the coercion map from GF(p)[t] to GF(p)(t)

EXAMPLES:

sage: R.<t> = GF(5)[]
sage: K = R.fraction_field()
sage: f = K.coerce_map_from(R); f
Ring morphism:
From: Univariate Polynomial Ring in t over Finite Field of size 5
To:   Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
sage: type(f)
<class 'sage.rings.fraction_field_FpT.Polyring_FpT_coerce'>

section()#

Return the section of this inclusion: the partially defined map from GF(p)(t) back to GF(p)[t], defined on elements with unit denominator.

EXAMPLES:

sage: R.<t> = GF(5)[]
sage: K = R.fraction_field()
sage: f = K.coerce_map_from(R)
sage: g = f.section(); g
Section map:
From: Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
To:   Univariate Polynomial Ring in t over Finite Field of size 5
sage: t = K.gen()
sage: g(t)
t
sage: g(1/t)
Traceback (most recent call last):
...
ValueError: not integral

class sage.rings.fraction_field_FpT.ZZ_FpT_coerce#

This class represents the coercion map from ZZ to GF(p)(t)

EXAMPLES:

sage: R.<t> = GF(17)[]
sage: K = R.fraction_field()
sage: f = K.coerce_map_from(ZZ); f
Ring morphism:
From: Integer Ring
To:   Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 17
sage: type(f)
<class 'sage.rings.fraction_field_FpT.ZZ_FpT_coerce'>

section()#

Return the section of this inclusion: the partially defined map from GF(p)(t) back to ZZ, defined on constant elements.

EXAMPLES:

sage: R.<t> = GF(5)[]
sage: K = R.fraction_field()
sage: f = K.coerce_map_from(ZZ)
sage: g = f.section(); g
Composite map:
From: Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
To:   Integer Ring
Defn:   Section map:
From: Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
To:   Finite Field of size 5
then
Lifting map:
From: Finite Field of size 5
To:   Integer Ring
sage: t = K.gen()
sage: g(f(1,3,reduce=False))
2
sage: g(t)
Traceback (most recent call last):
...
ValueError: not constant
sage: g(1/t)
Traceback (most recent call last):
...
ValueError: not integral

sage.rings.fraction_field_FpT.unpickle_FpT_element(K, numer, denom)#

Used for pickling.