AUTHORS:
EXAMPLES:
We create an extension of a rational function fields, and do some simple arithmetic in it:
sage: K.<x> = FunctionField(GF(5^2,'a')); K
Rational function field in x over Finite Field in a of size 5^2
sage: R.<y> = K[]
sage: L.<y> = K.extension(y^3 - (x^3 + 2*x*y + 1/x)); L
Function field in y defined by y^3 + 3*x*y + (4*x^4 + 4)/x
sage: y^2
y^2
sage: y^3
2*x*y + (x^4 + 1)/x
sage: a = 1/y; a
(4*x/(4*x^4 + 4))*y^2 + 2*x^2/(4*x^4 + 4)
sage: a * y
1
We next make an extension of the above function field, illustrating that arithmetic with a tower of 3 fields is fully supported:
sage: S.<t> = L[]
sage: M.<t> = L.extension(t^2 - x*y)
sage: M
Function field in t defined by t^2 + 4*x*y
sage: t^2
x*y
sage: 1/t
((1/(x^4 + 1))*y^2 + 2*x/(4*x^4 + 4))*t
sage: M.base_field()
Function field in y defined by y^3 + 3*x*y + (4*x^4 + 4)/x
sage: M.base_field().base_field()
Rational function field in x over Finite Field in a of size 5^2
TESTS:
sage: TestSuite(K).run()
sage: TestSuite(L).run() # long time (8s on sage.math, 2012)
sage: TestSuite(M).run() # long time (52s on sage.math, 2012)
The following two test suites do not pass _test_elements yet since R.an_element() has a _test_category method wich it should not have. It is not the fault of the function field code so this will be fixed in another ticket:
sage: TestSuite(R).run(skip = '_test_elements')
sage: TestSuite(S).run(skip = '_test_elements')
Bases: sage.rings.ring.Field
The abstract base class for all function fields.
EXAMPLES:
sage: K.<x> = FunctionField(QQ)
sage: isinstance(K, sage.rings.function_field.function_field.FunctionField)
True
Return the characteristic of this function field.
EXAMPLES:
sage: K.<x> = FunctionField(QQ)
sage: K.characteristic()
0
sage: K.<x> = FunctionField(GF(7))
sage: K.characteristic()
7
sage: R.<y> = K[]
sage: L.<y> = K.extension(y^2-x)
sage: L.characteristic()
7
Create an extension L = K[y]/(f(y)) of a function field, defined by a univariate polynomial in one variable over this function field K.
INPUT:
- f – a univariate polynomial over self
- names – None or string or length-1 tuple
OUTPUT:
- a function field
EXAMPLES:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: K.extension(y^5 - x^3 - 3*x + x*y)
Function field in y defined by y^5 + x*y - x^3 - 3*x
A nonintegral defining polynomial:
sage: K.<t> = FunctionField(QQ); R.<y> = K[]
sage: K.extension(y^3 + (1/t)*y + t^3/(t+1))
Function field in y defined by y^3 + 1/t*y + t^3/(t + 1)
The defining polynomial need not be monic or integral:
sage: K.extension(t*y^3 + (1/t)*y + t^3/(t+1))
Function field in y defined by t*y^3 + 1/t*y + t^3/(t + 1)
Return whether this function field is finite, which it is not.
EXAMPLES:
sage: R.<t> = FunctionField(QQ)
sage: R.is_finite()
False
sage: R.<t> = FunctionField(GF(7))
sage: R.is_finite()
False
Return the order in this function field generated over the maximal order by x or the elements of x if x is a list.
INPUT:
- x – element of self, or a list of elements of self
- check – bool (default: True); if True, check that x really generates an order
EXAMPLES:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]; L.<y> = K.extension(y^3 + x^3 + 4*x + 1)
sage: O = L.order(y); O
Order in Function field in y defined by y^3 + x^3 + 4*x + 1
sage: O.basis()
(1, y, y^2)
sage: Z = K.order(x); Z
Order in Rational function field in x over Rational Field
sage: Z.basis()
(1,)
Orders with multiple generators, not yet supported:
sage: Z = K.order([x,x^2]); Z
Traceback (most recent call last):
...
NotImplementedError
Return the order with given basis over the maximal order of the base field.
INPUT:
- basis – a list of elements of self
- check – bool (default: True); if True, check that the basis is really linearly independent and that the module it spans is closed under multiplication, and contains the identity element.
OUTPUT:
- an order in this function field
EXAMPLES:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]; L.<y> = K.extension(y^3 + x^3 + 4*x + 1)
sage: O = L.order_with_basis([1, y, y^2]); O
Order in Function field in y defined by y^3 + x^3 + 4*x + 1
sage: O.basis()
(1, y, y^2)
Note that 1 does not need to be an element of the basis, as long it is in the module spanned by it:
sage: O = L.order_with_basis([1+y, y, y^2]); O
Order in Function field in y defined by y^3 + x^3 + 4*x + 1
sage: O.basis()
(y + 1, y, y^2)
The following error is raised when the module spanned by the basis is not closed under multiplication:
sage: O = L.order_with_basis([1, x^2 + x*y, (2/3)*y^2]); O
Traceback (most recent call last):
...
ValueError: The module generated by basis [1, x*y + x^2, 2/3*y^2] must be closed under multiplication
and this happens when the identity is not in the module spanned by the basis:
sage: O = L.order_with_basis([x, x^2 + x*y, (2/3)*y^2])
Traceback (most recent call last):
...
ValueError: The identity element must be in the module spanned by basis [x, x*y + x^2, 2/3*y^2]
Return a list of elements in the function field.
EXAMPLES:
sage: K.<x> = FunctionField(QQ)
sage: elements = K.some_elements()
sage: elements # random output
[(x - 3/2)/(x^2 - 12/5*x + 1/18)]
sage: False in [e in K for e in elements]
False
Bases: sage.rings.function_field.function_field.FunctionField
A function field defined by a univariate polynomial, as an extension of the base field.
EXAMPLES:
We make a function field defined by a degree 5 polynomial over the rational function field over the rational numbers:
sage: K.<x> = FunctionField(QQ)
sage: R.<y> = K[]
sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x)); L
Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x
We next make a function field over the above nontrivial function field L:
sage: S.<z> = L[]
sage: M.<z> = L.extension(z^2 + y*z + y); M
Function field in z defined by z^2 + y*z + y
sage: 1/z
((x/(-x^4 - 1))*y^4 - 2*x^2/(-x^4 - 1))*z - 1
sage: z * (1/z)
1
We drill down the tower of function fields:
sage: M.base_field()
Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x
sage: M.base_field().base_field()
Rational function field in x over Rational Field
sage: M.base_field().base_field().constant_field()
Rational Field
sage: M.constant_base_field()
Rational Field
Warning
It is not checked if the polynomial used to define this function field is irreducible Hence it is not guaranteed that this object really is a field! This is illustrated below.
sage: K.<x>=FunctionField(QQ)
sage: R.<y> = K[]
sage: L.<y>=K.extension(x^2-y^2)
sage: (y-x)*(y+x)
0
sage: 1/(y-x)
1
sage: y-x==0; y+x==0
False
False
Return the base field of this function field. This function field is presented as L = K[y]/(f(y)), and the base field is by definition the field K.
EXAMPLES:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
sage: L.base_field()
Rational function field in x over Rational Field
Return the constant field of the base rational function field.
EXAMPLES:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x)); L
Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x
sage: L.constant_base_field()
Rational Field
sage: S.<z> = L[]
sage: M.<z> = L.extension(z^2 - y)
sage: M.constant_base_field()
Rational Field
Return the algebraic closure of the constant field of the base field in this function field.
EXAMPLES:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
sage: L.constant_field()
Traceback (most recent call last):
...
NotImplementedError
Return the degree of this function field over its base function field.
EXAMPLES:
sage: K.<x> = FunctionField(QQ)
sage: R.<y> = K[]
sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x)); L
Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x
sage: L.degree()
5
If we view self as being presented as K[y]/(f(y)), then this function returns the order generated by the class of y. If f is not monic, then _make_monic_integral() is called, and instead we get the order generated by some integral multiple of a root of f.
EXAMPLES:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
sage: O = L.equation_order()
sage: O.basis()
(1, x*y, x^2*y^2, x^3*y^3, x^4*y^4)
We try an example, in which the defining polynomial is not monic and is not integral:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(x^2*y^5 - 1/x); L
Function field in y defined by x^2*y^5 - 1/x
sage: O = L.equation_order()
sage: O.basis()
(1, x^3*y, x^6*y^2, x^9*y^3, x^12*y^4)
Return the n-th generator of this function field. By default n is 0; any other value of n leads to an error. The generator is the class of y, if we view self as being presented as K[y]/(f(y)).
EXAMPLES:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
sage: L.gen()
y
sage: L.gen(1)
Traceback (most recent call last):
...
IndexError: Only one generator.
Return the genus of this function field For now, the genus is computed using singular
EXAMPLES:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^3 - (x^3 + 2*x*y + 1/x))
sage: L.genus()
3
Create a homomorphism from self to another function field.
INPUT:
- im_gens – a list of images of the generators of self and of successive base rings.
- base_morphism – (default: None) a homomorphism of the base ring, after the im_gens are used. Thus if im_gens has length 2, then base_morphism should be a morphism from self.base_ring().base_ring().
EXAMPLES:
We create a rational function field, and a quadratic extension of it:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^2 - x^3 - 1)
We make the field automorphism that sends y to -y:
sage: f = L.hom(-y); f
Morphism of function fields defined by y |--> -y
Evaluation works:
sage: f(y*x - 1/x)
-x*y - 1/x
We try to define an invalid morphism:
sage: f = L.hom(y+1)
Traceback (most recent call last):
...
ValueError: invalid morphism
We make a morphism of the base rational function field:
sage: phi = K.hom(x+1); phi
Morphism of function fields defined by x |--> x + 1
sage: phi(x^3 - 3)
x^3 + 3*x^2 + 3*x - 2
sage: (x+1)^3-3
x^3 + 3*x^2 + 3*x - 2
We make a morphism by specifying where the generators and the base generators go:
sage: L.hom([-y, x])
Morphism of function fields defined by y |--> -y, x |--> x
The usage of the keyword base_morphism is not implemented yet:
sage: L.hom([-y, x-1], base_morphism=phi)
Traceback (most recent call last):
...
NotImplementedError: Function field homorphisms with optional argument base_morphism are not implemented yet. Please specify the images of the generators of the base fields manually.
We make another extension of a rational function field:
sage: K2.<t> = FunctionField(QQ); R2.<w> = K2[]
sage: L2.<w> = K2.extension((4*w)^2 - (t+1)^3 - 1)
We define a morphism, by giving the images of generators:
sage: f = L.hom([4*w, t+1]); f
Morphism of function fields defined by y |--> 4*w, x |--> t + 1
Evaluation works, as expected:
sage: f(y+x)
4*w + t + 1
sage: f(x*y + x/(x^2+1))
(4*t + 4)*w + (t + 1)/(t^2 + 2*t + 2)
We make another extension of a rational function field:
sage: K3.<yy> = FunctionField(QQ); R3.<xx> = K3[]
sage: L3.<xx> = K3.extension(yy^2 - xx^3 - 1)
This is the function field L with the generators exchanged. We define a morphism to L:
sage: g = L3.hom([x,y]); g
Morphism of function fields defined by xx |--> x, yy |--> y
Return the maximal_order of self. If we view self as L = K[y]/(f(y)), then this is the ring of elements of L that are integral over K.
EXAMPLES:
This is not yet implemented...:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
sage: L.maximal_order()
Traceback (most recent call last):
...
NotImplementedError
Return a function field isomorphic to self, but with defining polynomial that is monic and integral over the base field.
INPUT:
- names – name of the generator of the new field this function constructs
EXAMPLES:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(x^2*y^5 - 1/x); L
Function field in y defined by x^2*y^5 - 1/x
sage: A, from_A, to_A = L.monic_integral_model('z')
sage: A
Function field in z defined by y^5 - x^12
sage: from_A
Morphism of function fields defined by z |--> x^3*y
sage: to_A
Morphism of function fields defined by y |--> 1/x^3*z
sage: to_A(y)
1/x^3*z
sage: from_A(to_A(y))
y
sage: from_A(to_A(1/y))
x^3*y^4
sage: from_A(to_A(1/y)) == 1/y
True
Return the number of generators of this function field over its base field. This is by definition 1.
EXAMPLES:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
sage: L.ngens()
1
Return the univariate polynomial that defines this function field, i.e., the polynomial f(y) so that this function field is of the form K[y]/(f(y)).
EXAMPLES:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
sage: L.polynomial()
y^5 - 2*x*y + (-x^4 - 1)/x
Return the polynomial ring used to represent elements of this function field. If we view this function field as being presented as K[y]/(f(y)), then this function returns the ring K[y].
EXAMPLES:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
sage: L.polynomial_ring()
Univariate Polynomial Ring in y over Rational function field in x over Rational Field
Create a random element of this function field. Parameters are passed onto the random_element method of the base_field.
EXAMPLES:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^2 - (x^2 + x))
sage: L.random_element() # random
((x^2 - x + 2/3)/(x^2 + 1/3*x - 1))*y^2 + ((-1/4*x^2 + 1/2*x - 1)/(-5/2*x + 2/3))*y + (-1/2*x^2 - 4)/(-12*x^2 + 1/2*x - 1/95)
Return a vector space V and isomorphisms self –> V and V –> self.
This function allows us to identify the elements of self with elements of a vector space over the base field, which is useful for representation and arithmetic with orders, ideals, etc.
OUTPUT:
- V – a vector space over base field
- from_V – an isomorphism from V to self
- to_V – an isomorphism from self to V
EXAMPLES:
We define a function field:
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x)); L
Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x
We get the vector spaces, and maps back and forth:
sage: V, from_V, to_V = L.vector_space()
sage: V
Vector space of dimension 5 over Rational function field in x over Rational Field
sage: from_V
Isomorphism morphism:
From: Vector space of dimension 5 over Rational function field in x over Rational Field
To: Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x
sage: to_V
Isomorphism morphism:
From: Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x
To: Vector space of dimension 5 over Rational function field in x over Rational Field
We convert an element of the vector space back to the function field:
sage: from_V(V.1)
y
We define an interesting element of the function field:
sage: a = 1/L.0; a
(-x/(-x^4 - 1))*y^4 + 2*x^2/(-x^4 - 1)
We convert it to the vector space, and get a vector over the base field:
sage: to_V(a)
(2*x^2/(-x^4 - 1), 0, 0, 0, -x/(-x^4 - 1))
We convert to and back, and get the same element:
sage: from_V(to_V(a)) == a
True
In the other direction:
sage: v = x*V.0 + (1/x)*V.1
sage: to_V(from_V(v)) == v
True
And we show how it works over an extension of an extension field:
sage: R2.<z> = L[]; M.<z> = L.extension(z^2 -y)
sage: M.vector_space()
(Vector space of dimension 2 over Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x, Isomorphism morphism:
From: Vector space of dimension 2 over Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x
To: Function field in z defined by z^2 - y, Isomorphism morphism:
From: Function field in z defined by z^2 - y
To: Vector space of dimension 2 over Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x)
Bases: sage.rings.function_field.function_field.FunctionField
A rational function field K(t) in one variable, over an arbitrary base field.
EXAMPLES:
sage: K.<t> = FunctionField(GF(3)); K
Rational function field in t over Finite Field of size 3
sage: K.gen()
t
sage: 1/t + t^3 + 5
(t^4 + 2*t + 1)/t
There are various ways to get at the underlying fields and rings associated to a rational function field:
sage: K.<t> = FunctionField(GF(7))
sage: K.base_field()
Rational function field in t over Finite Field of size 7
sage: K.field()
Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7
sage: K.constant_field()
Finite Field of size 7
sage: K.maximal_order()
Maximal order in Rational function field in t over Finite Field of size 7
We define a morphism:
sage: K.<t> = FunctionField(QQ)
sage: L = FunctionField(QQ, 'tbar') # give variable name as second input
sage: K.hom(L.gen())
Morphism of function fields defined by t |--> tbar
Return the base field of this rational function field, which is just this function field itself.
EXAMPLES:
sage: K.<t> = FunctionField(GF(7))
sage: K.base_field()
Rational function field in t over Finite Field of size 7
Return the field that this rational function field is a transcendental extension of.
EXAMPLES:
sage: K.<t> = FunctionField(QQ)
sage: K.constant_field()
Rational Field
Return the field that this rational function field is a transcendental extension of.
EXAMPLES:
sage: K.<t> = FunctionField(QQ)
sage: K.constant_field()
Rational Field
Return the degree over the base field of this rational function field. Since the base field is the rational function field itself, the degree is 1.
EXAMPLES:
sage: K.<t> = FunctionField(QQ)
sage: K.degree()
1
Return the maximal order of this function field. Since this is a rational function field it is of the form K(t), and the maximal order is by definition K[t].
EXAMPLES:
sage: K.<t> = FunctionField(QQ)
sage: K.maximal_order()
Maximal order in Rational function field in t over Rational Field
sage: K.equation_order()
Maximal order in Rational function field in t over Rational Field
Return the underlying field, forgetting the function field structure.
EXAMPLES:
sage: K.<t> = FunctionField(GF(7))
sage: K.field()
Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7
Return the n-th generator of this function field. If n is not 0, then an IndexError is raised.
EXAMPLES:
sage: K.<t> = FunctionField(QQ); K.gen()
t
sage: K.gen().parent()
Rational function field in t over Rational Field
sage: K.gen(1)
Traceback (most recent call last):
...
IndexError: Only one generator.
Return the genus of this function field This is always equal 0 for a rational function field
EXAMPLES:
sage: K.<x> = FunctionField(QQ);
sage: K.genus()
0
Create a homomorphism from self to another function field.
INPUT:
- im_gens – exactly one element of some function field
- base_morphism – ignored
OUTPUT:
- a map between function fields
EXAMPLES:
We make a map from a rational function field to itself:
sage: K.<x> = FunctionField(GF(7))
sage: K.hom( (x^4 + 2)/x)
Morphism of function fields defined by x |--> (x^4 + 2)/x
We construct a map from a rational function field into a non-rational extension field:
sage: K.<x> = FunctionField(GF(7)); R.<y> = K[]
sage: L.<y> = K.extension(y^3 + 6*x^3 + x)
sage: f = K.hom(y^2 + y + 2); f
Morphism of function fields defined by x |--> y^2 + y + 2
sage: f(x)
y^2 + y + 2
sage: f(x^2)
5*y^2 + (x^3 + 6*x + 4)*y + 2*x^3 + 5*x + 4
Return the maximal order of this function field. Since this is a rational function field it is of the form K(t), and the maximal order is by definition K[t].
EXAMPLES:
sage: K.<t> = FunctionField(QQ)
sage: K.maximal_order()
Maximal order in Rational function field in t over Rational Field
sage: K.equation_order()
Maximal order in Rational function field in t over Rational Field
Return the number of generators, which is 1.
EXAMPLES:
sage: K.<t> = FunctionField(QQ)
sage: K.ngens()
1
Return a polynomial ring in one variable over this rational function field.
INPUT:
- var – a string (default: ‘x’)
EXAMPLES:
sage: K.<x> = FunctionField(QQ)
sage: K.polynomial_ring()
Univariate Polynomial Ring in x over Rational function field in x over Rational Field
sage: K.polynomial_ring('T')
Univariate Polynomial Ring in T over Rational function field in x over Rational Field
Create a random element of this rational function field. Parameters are passed onto the random_element method of the underlying fraction field.
EXAMPLES:
sage: FunctionField(QQ,'alpha').random_element()
(-1/2*alpha^2 - 4)/(-12*alpha^2 + 1/2*alpha - 1/95)
Return a vector space V and isomorphisms self –> V and V –> self.
OUTPUT:
- V – a vector space over the rational numbers
- from_V – an isomorphism from V to self
- to_V – an isomorphism from self to V
EXAMPLES:
sage: K.<x> = FunctionField(QQ)
sage: K.vector_space()
(Vector space of dimension 1 over Rational function field in x over Rational Field, Isomorphism morphism:
From: Vector space of dimension 1 over Rational function field in x over Rational Field
To: Rational function field in x over Rational Field, Isomorphism morphism:
From: Rational function field in x over Rational Field
To: Vector space of dimension 1 over Rational function field in x over Rational Field)
Return True if x is of function field type.
EXAMPLES:
sage: from sage.rings.function_field.function_field import is_FunctionField
sage: is_FunctionField(QQ)
False
sage: is_FunctionField(FunctionField(QQ,'t'))
True
Return True if x is of rational function field type.
EXAMPLES:
sage: from sage.rings.function_field.function_field import is_RationalFunctionField
sage: is_RationalFunctionField(QQ)
False
sage: is_RationalFunctionField(FunctionField(QQ,'t'))
True