Elements of function fields

Sage provides arithmetic with elements of function fields.

EXAMPLES:

Arithmetic with rational functions:

sage: K.<t> = FunctionField(QQ)
sage: f = t - 1
sage: g = t^2 - 3
sage: h = f^2/g^3
sage: h.valuation(t-1)
2
sage: h.valuation(t)
0
sage: h.valuation(t^2 - 3)
-3
>>> from sage.all import *
>>> K = FunctionField(QQ, names=('t',)); (t,) = K._first_ngens(1)
>>> f = t - Integer(1)
>>> g = t**Integer(2) - Integer(3)
>>> h = f**Integer(2)/g**Integer(3)
>>> h.valuation(t-Integer(1))
2
>>> h.valuation(t)
0
>>> h.valuation(t**Integer(2) - Integer(3))
-3
K.<t> = FunctionField(QQ)
f = t - 1
g = t^2 - 3
h = f^2/g^3
h.valuation(t-1)
h.valuation(t)
h.valuation(t^2 - 3)

Derivatives of elements in separable extensions:

sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]                                     # needs sage.rings.finite_rings
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)                                        # needs sage.rings.finite_rings sage.rings.function_field
sage: (y^3 + x).derivative()                                                        # needs sage.rings.finite_rings sage.rings.function_field
((x^2 + 1)/x^2)*y + (x^4 + x^3 + 1)/x^3
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> (y**Integer(3) + x).derivative()                                                        # needs sage.rings.finite_rings sage.rings.function_field
((x^2 + 1)/x^2)*y + (x^4 + x^3 + 1)/x^3
K.<x> = FunctionField(GF(4)); _.<Y> = K[]                                     # needs sage.rings.finite_rings
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                        # needs sage.rings.finite_rings sage.rings.function_field
(y^3 + x).derivative()                                                        # needs sage.rings.finite_rings sage.rings.function_field

The divisor of an element of a global function field:

sage: K.<x> = FunctionField(GF(2)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)                                        # needs sage.rings.function_field
sage: y.divisor()                                                                   # needs sage.rings.function_field
- Place (1/x, 1/x*y)
 - Place (x, x*y)
 + 2*Place (x + 1, x*y)
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(2)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.function_field
>>> y.divisor()                                                                   # needs sage.rings.function_field
- Place (1/x, 1/x*y)
 - Place (x, x*y)
 + 2*Place (x + 1, x*y)
K.<x> = FunctionField(GF(2)); _.<Y> = K[]
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                        # needs sage.rings.function_field
y.divisor()                                                                   # needs sage.rings.function_field

AUTHORS:

  • William Stein: initial version

  • Robert Bradshaw (2010-05-27): cythonize function field elements

  • Julian Rueth (2011-06-28, 2020-09-01): treat zero correctly; implement nth_root/is_nth_power

  • Maarten Derickx (2011-09-11): added doctests, fixed pickling

  • Kwankyu Lee (2017-04-30): added elements for global function fields

  • Vincent Macri (2024-09-03): added subs method

class sage.rings.function_field.element.FunctionFieldElement[source]

Bases: FieldElement

Abstract base class for function field elements.

EXAMPLES:

sage: t = FunctionField(QQ,'t').gen()
sage: isinstance(t, sage.rings.function_field.element.FunctionFieldElement)
True
>>> from sage.all import *
>>> t = FunctionField(QQ,'t').gen()
>>> isinstance(t, sage.rings.function_field.element.FunctionFieldElement)
True
t = FunctionField(QQ,'t').gen()
isinstance(t, sage.rings.function_field.element.FunctionFieldElement)
characteristic_polynomial(*args, **kwds)[source]

Return the characteristic polynomial of the element. Give an optional input string to name the variable in the characteristic polynomial.

EXAMPLES:

sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: x.characteristic_polynomial('W')                                      # needs sage.modules
W - x

sage: # needs sage.rings.function_field
sage: L.<y> = K.extension(y^2 - x*y + 4*x^3); R.<z> = L[]
sage: M.<z> = L.extension(z^3 - y^2*z + x)
sage: y.characteristic_polynomial('W')
W^2 - x*W + 4*x^3
sage: z.characteristic_polynomial('W')
W^3 + (-x*y + 4*x^3)*W + x
>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); R = K['y']; (y,) = R._first_ngens(1)
>>> x.characteristic_polynomial('W')                                      # needs sage.modules
W - x

>>> # needs sage.rings.function_field
>>> L = K.extension(y**Integer(2) - x*y + Integer(4)*x**Integer(3), names=('y',)); (y,) = L._first_ngens(1); R = L['z']; (z,) = R._first_ngens(1)
>>> M = L.extension(z**Integer(3) - y**Integer(2)*z + x, names=('z',)); (z,) = M._first_ngens(1)
>>> y.characteristic_polynomial('W')
W^2 - x*W + 4*x^3
>>> z.characteristic_polynomial('W')
W^3 + (-x*y + 4*x^3)*W + x
K.<x> = FunctionField(QQ); R.<y> = K[]
x.characteristic_polynomial('W')                                      # needs sage.modules
# needs sage.rings.function_field
L.<y> = K.extension(y^2 - x*y + 4*x^3); R.<z> = L[]
M.<z> = L.extension(z^3 - y^2*z + x)
y.characteristic_polynomial('W')
z.characteristic_polynomial('W')
charpoly(*args, **kwds)[source]

Return the characteristic polynomial of the element. Give an optional input string to name the variable in the characteristic polynomial.

EXAMPLES:

sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: x.characteristic_polynomial('W')                                      # needs sage.modules
W - x

sage: # needs sage.rings.function_field
sage: L.<y> = K.extension(y^2 - x*y + 4*x^3); R.<z> = L[]
sage: M.<z> = L.extension(z^3 - y^2*z + x)
sage: y.characteristic_polynomial('W')
W^2 - x*W + 4*x^3
sage: z.characteristic_polynomial('W')
W^3 + (-x*y + 4*x^3)*W + x
>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); R = K['y']; (y,) = R._first_ngens(1)
>>> x.characteristic_polynomial('W')                                      # needs sage.modules
W - x

>>> # needs sage.rings.function_field
>>> L = K.extension(y**Integer(2) - x*y + Integer(4)*x**Integer(3), names=('y',)); (y,) = L._first_ngens(1); R = L['z']; (z,) = R._first_ngens(1)
>>> M = L.extension(z**Integer(3) - y**Integer(2)*z + x, names=('z',)); (z,) = M._first_ngens(1)
>>> y.characteristic_polynomial('W')
W^2 - x*W + 4*x^3
>>> z.characteristic_polynomial('W')
W^3 + (-x*y + 4*x^3)*W + x
K.<x> = FunctionField(QQ); R.<y> = K[]
x.characteristic_polynomial('W')                                      # needs sage.modules
# needs sage.rings.function_field
L.<y> = K.extension(y^2 - x*y + 4*x^3); R.<z> = L[]
M.<z> = L.extension(z^3 - y^2*z + x)
y.characteristic_polynomial('W')
z.characteristic_polynomial('W')
degree()[source]

Return the max degree between the denominator and numerator.

EXAMPLES:

sage: FF.<t> = FunctionField(QQ)
sage: f = (t^2 + 3) / (t^3 - 1/3); f
(t^2 + 3)/(t^3 - 1/3)
sage: f.degree()
3

sage: FF.<t> = FunctionField(QQ)
sage: f = (t+8); f
t + 8
sage: f.degree()
1
>>> from sage.all import *
>>> FF = FunctionField(QQ, names=('t',)); (t,) = FF._first_ngens(1)
>>> f = (t**Integer(2) + Integer(3)) / (t**Integer(3) - Integer(1)/Integer(3)); f
(t^2 + 3)/(t^3 - 1/3)
>>> f.degree()
3

>>> FF = FunctionField(QQ, names=('t',)); (t,) = FF._first_ngens(1)
>>> f = (t+Integer(8)); f
t + 8
>>> f.degree()
1
FF.<t> = FunctionField(QQ)
f = (t^2 + 3) / (t^3 - 1/3); f
f.degree()
FF.<t> = FunctionField(QQ)
f = (t+8); f
f.degree()
derivative()[source]

Return the derivative of the element.

The derivative is with respect to the generator of the base rational function field, over which the function field is a separable extension.

EXAMPLES:

sage: K.<t> = FunctionField(QQ)
sage: f = (t + 1) / (t^2 - 1/3)
sage: f.derivative()                                                        # needs sage.modules
(-t^2 - 2*t - 1/3)/(t^4 - 2/3*t^2 + 1/9)

sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
sage: (y^3 + x).derivative()                                                # needs sage.rings.finite_rings sage.rings.function_field
((x^2 + 1)/x^2)*y + (x^4 + x^3 + 1)/x^3
>>> from sage.all import *
>>> K = FunctionField(QQ, names=('t',)); (t,) = K._first_ngens(1)
>>> f = (t + Integer(1)) / (t**Integer(2) - Integer(1)/Integer(3))
>>> f.derivative()                                                        # needs sage.modules
(-t^2 - 2*t - 1/3)/(t^4 - 2/3*t^2 + 1/9)

>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> (y**Integer(3) + x).derivative()                                                # needs sage.rings.finite_rings sage.rings.function_field
((x^2 + 1)/x^2)*y + (x^4 + x^3 + 1)/x^3
K.<t> = FunctionField(QQ)
f = (t + 1) / (t^2 - 1/3)
f.derivative()                                                        # needs sage.modules
K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
(y^3 + x).derivative()                                                # needs sage.rings.finite_rings sage.rings.function_field
differential()[source]

Return the differential \(dx\) where \(x\) is the element.

EXAMPLES:

sage: K.<t> = FunctionField(QQ)
sage: f = 1 / t
sage: f.differential()                                                      # needs sage.modules
(-1/t^2) d(t)

sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
sage: L.<y> = K.extension(Y^2 + Y + x +1/x)                                 # needs sage.rings.finite_rings sage.rings.function_field
sage: (y^3 + x).differential()                                              # needs sage.rings.finite_rings sage.rings.function_field
(((x^2 + 1)/x^2)*y + (x^4 + x^3 + 1)/x^3) d(x)
>>> from sage.all import *
>>> K = FunctionField(QQ, names=('t',)); (t,) = K._first_ngens(1)
>>> f = Integer(1) / t
>>> f.differential()                                                      # needs sage.modules
(-1/t^2) d(t)

>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(2) + Y + x +Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> (y**Integer(3) + x).differential()                                              # needs sage.rings.finite_rings sage.rings.function_field
(((x^2 + 1)/x^2)*y + (x^4 + x^3 + 1)/x^3) d(x)
K.<t> = FunctionField(QQ)
f = 1 / t
f.differential()                                                      # needs sage.modules
K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
L.<y> = K.extension(Y^2 + Y + x +1/x)                                 # needs sage.rings.finite_rings sage.rings.function_field
(y^3 + x).differential()                                              # needs sage.rings.finite_rings sage.rings.function_field
divisor()[source]

Return the divisor of the element.

EXAMPLES:

sage: K.<x> = FunctionField(GF(2))
sage: f = 1/(x^3 + x^2 + x)
sage: f.divisor()                                                           # needs sage.libs.pari sage.modules
3*Place (1/x)
 - Place (x)
 - Place (x^2 + x + 1)
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(2)), names=('x',)); (x,) = K._first_ngens(1)
>>> f = Integer(1)/(x**Integer(3) + x**Integer(2) + x)
>>> f.divisor()                                                           # needs sage.libs.pari sage.modules
3*Place (1/x)
 - Place (x)
 - Place (x^2 + x + 1)
K.<x> = FunctionField(GF(2))
f = 1/(x^3 + x^2 + x)
f.divisor()                                                           # needs sage.libs.pari sage.modules
sage: K.<x> = FunctionField(GF(2)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.function_field
sage: y.divisor()                                                           # needs sage.rings.function_field
- Place (1/x, 1/x*y)
 - Place (x, x*y)
 + 2*Place (x + 1, x*y)
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(2)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.function_field
>>> y.divisor()                                                           # needs sage.rings.function_field
- Place (1/x, 1/x*y)
 - Place (x, x*y)
 + 2*Place (x + 1, x*y)
K.<x> = FunctionField(GF(2)); _.<Y> = K[]
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.function_field
y.divisor()                                                           # needs sage.rings.function_field
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(2)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.function_field
>>> y.divisor()                                                           # needs sage.rings.function_field
- Place (1/x, 1/x*y)
 - Place (x, x*y)
 + 2*Place (x + 1, x*y)
K.<x> = FunctionField(GF(2)); _.<Y> = K[]
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.function_field
y.divisor()                                                           # needs sage.rings.function_field
divisor_of_poles()[source]

Return the divisor of poles for the element.

EXAMPLES:

sage: K.<x> = FunctionField(GF(2))
sage: f = 1/(x^3 + x^2 + x)
sage: f.divisor_of_poles()                                                  # needs sage.libs.pari sage.modules
Place (x)
 + Place (x^2 + x + 1)
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(2)), names=('x',)); (x,) = K._first_ngens(1)
>>> f = Integer(1)/(x**Integer(3) + x**Integer(2) + x)
>>> f.divisor_of_poles()                                                  # needs sage.libs.pari sage.modules
Place (x)
 + Place (x^2 + x + 1)
K.<x> = FunctionField(GF(2))
f = 1/(x^3 + x^2 + x)
f.divisor_of_poles()                                                  # needs sage.libs.pari sage.modules
sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
sage: (x/y).divisor_of_poles()                                              # needs sage.rings.finite_rings sage.rings.function_field
Place (1/x, 1/x*y) + 2*Place (x + 1, x*y)
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> (x/y).divisor_of_poles()                                              # needs sage.rings.finite_rings sage.rings.function_field
Place (1/x, 1/x*y) + 2*Place (x + 1, x*y)
K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
(x/y).divisor_of_poles()                                              # needs sage.rings.finite_rings sage.rings.function_field
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> (x/y).divisor_of_poles()                                              # needs sage.rings.finite_rings sage.rings.function_field
Place (1/x, 1/x*y) + 2*Place (x + 1, x*y)
K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
(x/y).divisor_of_poles()                                              # needs sage.rings.finite_rings sage.rings.function_field
divisor_of_zeros()[source]

Return the divisor of zeros for the element.

EXAMPLES:

sage: K.<x> = FunctionField(GF(2))
sage: f = 1/(x^3 + x^2 + x)
sage: f.divisor_of_zeros()                                                  # needs sage.libs.pari sage.modules
3*Place (1/x)
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(2)), names=('x',)); (x,) = K._first_ngens(1)
>>> f = Integer(1)/(x**Integer(3) + x**Integer(2) + x)
>>> f.divisor_of_zeros()                                                  # needs sage.libs.pari sage.modules
3*Place (1/x)
K.<x> = FunctionField(GF(2))
f = 1/(x^3 + x^2 + x)
f.divisor_of_zeros()                                                  # needs sage.libs.pari sage.modules
sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
sage: (x/y).divisor_of_zeros()                                              # needs sage.rings.finite_rings sage.rings.function_field
3*Place (x, x*y)
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> (x/y).divisor_of_zeros()                                              # needs sage.rings.finite_rings sage.rings.function_field
3*Place (x, x*y)
K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
(x/y).divisor_of_zeros()                                              # needs sage.rings.finite_rings sage.rings.function_field
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> (x/y).divisor_of_zeros()                                              # needs sage.rings.finite_rings sage.rings.function_field
3*Place (x, x*y)
K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
(x/y).divisor_of_zeros()                                              # needs sage.rings.finite_rings sage.rings.function_field
evaluate(place)[source]

Return the value of the element at the place.

INPUT:

  • place – a function field place

OUTPUT:

If the element is in the valuation ring at the place, then an element in the residue field at the place is returned. Otherwise, a ValueError is raised.

EXAMPLES:

sage: K.<t> = FunctionField(GF(5))
sage: p = K.place_infinite()
sage: f = 1/t^2 + 3
sage: f.evaluate(p)
3
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(5)), names=('t',)); (t,) = K._first_ngens(1)
>>> p = K.place_infinite()
>>> f = Integer(1)/t**Integer(2) + Integer(3)
>>> f.evaluate(p)
3
K.<t> = FunctionField(GF(5))
p = K.place_infinite()
f = 1/t^2 + 3
f.evaluate(p)
sage: # needs sage.rings.finite_rings sage.rings.function_field
sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)
sage: p, = L.places_infinite()
sage: p, = L.places_infinite()
sage: (y + x).evaluate(p)
Traceback (most recent call last):
...
ValueError: has a pole at the place
sage: (y/x + 1).evaluate(p)
1
>>> from sage.all import *
>>> # needs sage.rings.finite_rings sage.rings.function_field
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)
>>> p, = L.places_infinite()
>>> p, = L.places_infinite()
>>> (y + x).evaluate(p)
Traceback (most recent call last):
...
ValueError: has a pole at the place
>>> (y/x + Integer(1)).evaluate(p)
1
# needs sage.rings.finite_rings sage.rings.function_field
K.<x> = FunctionField(GF(4)); _.<Y> = K[]
L.<y> = K.extension(Y^2 + Y + x + 1/x)
p, = L.places_infinite()
p, = L.places_infinite()
(y + x).evaluate(p)
(y/x + 1).evaluate(p)
>>> from sage.all import *
>>> # needs sage.rings.finite_rings sage.rings.function_field
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)
>>> p, = L.places_infinite()
>>> p, = L.places_infinite()
>>> (y + x).evaluate(p)
Traceback (most recent call last):
...
ValueError: has a pole at the place
>>> (y/x + Integer(1)).evaluate(p)
1
# needs sage.rings.finite_rings sage.rings.function_field
K.<x> = FunctionField(GF(4)); _.<Y> = K[]
L.<y> = K.extension(Y^2 + Y + x + 1/x)
p, = L.places_infinite()
p, = L.places_infinite()
(y + x).evaluate(p)
(y/x + 1).evaluate(p)
higher_derivative(i, separating_element=None)[source]

Return the \(i\)-th derivative of the element with respect to the separating element.

INPUT:

  • i – nonnegative integer

  • separating_element – a separating element of the function field; the default is the generator of the rational function field

EXAMPLES:

sage: K.<t> = FunctionField(GF(2))
sage: f = t^2
sage: f.higher_derivative(2)                                                # needs sage.rings.function_field
1
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(2)), names=('t',)); (t,) = K._first_ngens(1)
>>> f = t**Integer(2)
>>> f.higher_derivative(Integer(2))                                                # needs sage.rings.function_field
1
K.<t> = FunctionField(GF(2))
f = t^2
f.higher_derivative(2)                                                # needs sage.rings.function_field
sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
sage: (y^3 + x).higher_derivative(2)                                        # needs sage.rings.finite_rings sage.rings.function_field
1/x^3*y + (x^6 + x^4 + x^3 + x^2 + x + 1)/x^5
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> (y**Integer(3) + x).higher_derivative(Integer(2))                                        # needs sage.rings.finite_rings sage.rings.function_field
1/x^3*y + (x^6 + x^4 + x^3 + x^2 + x + 1)/x^5
K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
(y^3 + x).higher_derivative(2)                                        # needs sage.rings.finite_rings sage.rings.function_field
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> (y**Integer(3) + x).higher_derivative(Integer(2))                                        # needs sage.rings.finite_rings sage.rings.function_field
1/x^3*y + (x^6 + x^4 + x^3 + x^2 + x + 1)/x^5
K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
(y^3 + x).higher_derivative(2)                                        # needs sage.rings.finite_rings sage.rings.function_field
is_integral()[source]

Determine if the element is integral over the maximal order of the base field.

EXAMPLES:

sage: # needs sage.rings.function_field
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^2 - x*y + 4*x^3)
sage: y.is_integral()
True
sage: (y/x).is_integral()
True
sage: (y/x)^2 - (y/x) + 4*x
0
sage: (y/x^2).is_integral()
False
sage: (y/x).minimal_polynomial('W')
W^2 - W + 4*x
>>> from sage.all import *
>>> # needs sage.rings.function_field
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(2) - x*y + Integer(4)*x**Integer(3), names=('y',)); (y,) = L._first_ngens(1)
>>> y.is_integral()
True
>>> (y/x).is_integral()
True
>>> (y/x)**Integer(2) - (y/x) + Integer(4)*x
0
>>> (y/x**Integer(2)).is_integral()
False
>>> (y/x).minimal_polynomial('W')
W^2 - W + 4*x
# needs sage.rings.function_field
K.<x> = FunctionField(QQ); R.<y> = K[]
L.<y> = K.extension(y^2 - x*y + 4*x^3)
y.is_integral()
(y/x).is_integral()
(y/x)^2 - (y/x) + 4*x
(y/x^2).is_integral()
(y/x).minimal_polynomial('W')
is_nth_power(n)[source]

Return whether this element is an n-th power in the rational function field.

INPUT:

  • n – integer

OUTPUT:

Returns True if there is an element \(a\) in the function field such that this element equals \(a^n\).

See also

nth_root()

EXAMPLES:

sage: K.<x> = FunctionField(GF(3))
sage: f = (x+1)/(x-1)
sage: f.is_nth_power(2)
False
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(3)), names=('x',)); (x,) = K._first_ngens(1)
>>> f = (x+Integer(1))/(x-Integer(1))
>>> f.is_nth_power(Integer(2))
False
K.<x> = FunctionField(GF(3))
f = (x+1)/(x-1)
f.is_nth_power(2)
matrix(base=None)[source]

Return the matrix of multiplication by this element, interpreting this element as an element of a vector space over base.

INPUT:

  • base – a function field (default: None); if None, then the matrix is formed over the base field of this function field

EXAMPLES:

A rational function field:

sage: K.<t> = FunctionField(QQ)
sage: t.matrix()                                                            # needs sage.modules
[t]
sage: (1/(t+1)).matrix()                                                    # needs sage.modules
[1/(t + 1)]
>>> from sage.all import *
>>> K = FunctionField(QQ, names=('t',)); (t,) = K._first_ngens(1)
>>> t.matrix()                                                            # needs sage.modules
[t]
>>> (Integer(1)/(t+Integer(1))).matrix()                                                    # needs sage.modules
[1/(t + 1)]
K.<t> = FunctionField(QQ)
t.matrix()                                                            # needs sage.modules
(1/(t+1)).matrix()                                                    # needs sage.modules

Now an example in a nontrivial extension of a rational function field:

sage: # needs sage.rings.function_field
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^2 - x*y + 4*x^3)
sage: y.matrix()
[     0      1]
[-4*x^3      x]
sage: y.matrix().charpoly('Z')
Z^2 - x*Z + 4*x^3
>>> from sage.all import *
>>> # needs sage.rings.function_field
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(2) - x*y + Integer(4)*x**Integer(3), names=('y',)); (y,) = L._first_ngens(1)
>>> y.matrix()
[     0      1]
[-4*x^3      x]
>>> y.matrix().charpoly('Z')
Z^2 - x*Z + 4*x^3
# needs sage.rings.function_field
K.<x> = FunctionField(QQ); R.<y> = K[]
L.<y> = K.extension(y^2 - x*y + 4*x^3)
y.matrix()
y.matrix().charpoly('Z')

An example in a relative extension, where neither function field is rational:

sage: # needs sage.rings.function_field
sage: K.<x> = FunctionField(QQ)
sage: R.<y> = K[]
sage: L.<y> = K.extension(y^2 - x*y + 4*x^3)
sage: M.<T> = L[]
sage: Z.<alpha> = L.extension(T^3 - y^2*T + x)
sage: alpha.matrix()
[          0           1           0]
[          0           0           1]
[         -x x*y - 4*x^3           0]
sage: alpha.matrix(K)
[           0            0            1            0            0            0]
[           0            0            0            1            0            0]
[           0            0            0            0            1            0]
[           0            0            0            0            0            1]
[          -x            0       -4*x^3            x            0            0]
[           0           -x       -4*x^4 -4*x^3 + x^2            0            0]
sage: alpha.matrix(Z)
[alpha]
>>> from sage.all import *
>>> # needs sage.rings.function_field
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1)
>>> R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(2) - x*y + Integer(4)*x**Integer(3), names=('y',)); (y,) = L._first_ngens(1)
>>> M = L['T']; (T,) = M._first_ngens(1)
>>> Z = L.extension(T**Integer(3) - y**Integer(2)*T + x, names=('alpha',)); (alpha,) = Z._first_ngens(1)
>>> alpha.matrix()
[          0           1           0]
[          0           0           1]
[         -x x*y - 4*x^3           0]
>>> alpha.matrix(K)
[           0            0            1            0            0            0]
[           0            0            0            1            0            0]
[           0            0            0            0            1            0]
[           0            0            0            0            0            1]
[          -x            0       -4*x^3            x            0            0]
[           0           -x       -4*x^4 -4*x^3 + x^2            0            0]
>>> alpha.matrix(Z)
[alpha]
# needs sage.rings.function_field
K.<x> = FunctionField(QQ)
R.<y> = K[]
L.<y> = K.extension(y^2 - x*y + 4*x^3)
M.<T> = L[]
Z.<alpha> = L.extension(T^3 - y^2*T + x)
alpha.matrix()
alpha.matrix(K)
alpha.matrix(Z)

We show that this matrix does indeed work as expected when making a vector space from a function field:

sage: # needs sage.rings.function_field
sage: K.<x> = FunctionField(QQ)
sage: R.<y> = K[]
sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
sage: V, from_V, to_V = L.vector_space()
sage: y5 = to_V(y^5); y5
((x^4 + 1)/x, 2*x, 0, 0, 0)
sage: y4y = to_V(y^4) * y.matrix(); y4y
((x^4 + 1)/x, 2*x, 0, 0, 0)
sage: y5 == y4y
True
>>> from sage.all import *
>>> # needs sage.rings.function_field
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1)
>>> R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(5) - (x**Integer(3) + Integer(2)*x*y + Integer(1)/x), names=('y',)); (y,) = L._first_ngens(1)
>>> V, from_V, to_V = L.vector_space()
>>> y5 = to_V(y**Integer(5)); y5
((x^4 + 1)/x, 2*x, 0, 0, 0)
>>> y4y = to_V(y**Integer(4)) * y.matrix(); y4y
((x^4 + 1)/x, 2*x, 0, 0, 0)
>>> y5 == y4y
True
# needs sage.rings.function_field
K.<x> = FunctionField(QQ)
R.<y> = K[]
L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
V, from_V, to_V = L.vector_space()
y5 = to_V(y^5); y5
y4y = to_V(y^4) * y.matrix(); y4y
y5 == y4y
minimal_polynomial(*args, **kwds)[source]

Return the minimal polynomial of the element. Give an optional input string to name the variable in the characteristic polynomial.

EXAMPLES:

sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: x.minimal_polynomial('W')                                             # needs sage.modules
W - x

sage: # needs sage.rings.function_field
sage: L.<y> = K.extension(y^2 - x*y + 4*x^3); R.<z> = L[]
sage: M.<z> = L.extension(z^3 - y^2*z + x)
sage: y.minimal_polynomial('W')
W^2 - x*W + 4*x^3
sage: z.minimal_polynomial('W')
W^3 + (-x*y + 4*x^3)*W + x
>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); R = K['y']; (y,) = R._first_ngens(1)
>>> x.minimal_polynomial('W')                                             # needs sage.modules
W - x

>>> # needs sage.rings.function_field
>>> L = K.extension(y**Integer(2) - x*y + Integer(4)*x**Integer(3), names=('y',)); (y,) = L._first_ngens(1); R = L['z']; (z,) = R._first_ngens(1)
>>> M = L.extension(z**Integer(3) - y**Integer(2)*z + x, names=('z',)); (z,) = M._first_ngens(1)
>>> y.minimal_polynomial('W')
W^2 - x*W + 4*x^3
>>> z.minimal_polynomial('W')
W^3 + (-x*y + 4*x^3)*W + x
K.<x> = FunctionField(QQ); R.<y> = K[]
x.minimal_polynomial('W')                                             # needs sage.modules
# needs sage.rings.function_field
L.<y> = K.extension(y^2 - x*y + 4*x^3); R.<z> = L[]
M.<z> = L.extension(z^3 - y^2*z + x)
y.minimal_polynomial('W')
z.minimal_polynomial('W')
minpoly(*args, **kwds)[source]

Return the minimal polynomial of the element. Give an optional input string to name the variable in the characteristic polynomial.

EXAMPLES:

sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: x.minimal_polynomial('W')                                             # needs sage.modules
W - x

sage: # needs sage.rings.function_field
sage: L.<y> = K.extension(y^2 - x*y + 4*x^3); R.<z> = L[]
sage: M.<z> = L.extension(z^3 - y^2*z + x)
sage: y.minimal_polynomial('W')
W^2 - x*W + 4*x^3
sage: z.minimal_polynomial('W')
W^3 + (-x*y + 4*x^3)*W + x
>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); R = K['y']; (y,) = R._first_ngens(1)
>>> x.minimal_polynomial('W')                                             # needs sage.modules
W - x

>>> # needs sage.rings.function_field
>>> L = K.extension(y**Integer(2) - x*y + Integer(4)*x**Integer(3), names=('y',)); (y,) = L._first_ngens(1); R = L['z']; (z,) = R._first_ngens(1)
>>> M = L.extension(z**Integer(3) - y**Integer(2)*z + x, names=('z',)); (z,) = M._first_ngens(1)
>>> y.minimal_polynomial('W')
W^2 - x*W + 4*x^3
>>> z.minimal_polynomial('W')
W^3 + (-x*y + 4*x^3)*W + x
K.<x> = FunctionField(QQ); R.<y> = K[]
x.minimal_polynomial('W')                                             # needs sage.modules
# needs sage.rings.function_field
L.<y> = K.extension(y^2 - x*y + 4*x^3); R.<z> = L[]
M.<z> = L.extension(z^3 - y^2*z + x)
y.minimal_polynomial('W')
z.minimal_polynomial('W')
norm()[source]

Return the norm of the element.

EXAMPLES:

sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^2 - x*y + 4*x^3)                                # needs sage.rings.function_field
sage: y.norm()                                                              # needs sage.rings.function_field
4*x^3
>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(2) - x*y + Integer(4)*x**Integer(3), names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.function_field
>>> y.norm()                                                              # needs sage.rings.function_field
4*x^3
K.<x> = FunctionField(QQ); R.<y> = K[]
L.<y> = K.extension(y^2 - x*y + 4*x^3)                                # needs sage.rings.function_field
y.norm()                                                              # needs sage.rings.function_field

The norm is relative:

sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^2 - x*y + 4*x^3); R.<z> = L[]                   # needs sage.rings.function_field
sage: M.<z> = L.extension(z^3 - y^2*z + x)                                  # needs sage.rings.function_field
sage: z.norm()                                                              # needs sage.rings.function_field
-x
sage: z.norm().parent()                                                     # needs sage.rings.function_field
Function field in y defined by y^2 - x*y + 4*x^3
>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(2) - x*y + Integer(4)*x**Integer(3), names=('y',)); (y,) = L._first_ngens(1); R = L['z']; (z,) = R._first_ngens(1)# needs sage.rings.function_field
>>> M = L.extension(z**Integer(3) - y**Integer(2)*z + x, names=('z',)); (z,) = M._first_ngens(1)# needs sage.rings.function_field
>>> z.norm()                                                              # needs sage.rings.function_field
-x
>>> z.norm().parent()                                                     # needs sage.rings.function_field
Function field in y defined by y^2 - x*y + 4*x^3
K.<x> = FunctionField(QQ); R.<y> = K[]
L.<y> = K.extension(y^2 - x*y + 4*x^3); R.<z> = L[]                   # needs sage.rings.function_field
M.<z> = L.extension(z^3 - y^2*z + x)                                  # needs sage.rings.function_field
z.norm()                                                              # needs sage.rings.function_field
z.norm().parent()                                                     # needs sage.rings.function_field
nth_root(n)[source]

Return an n-th root of this element in the function field.

INPUT:

  • n – integer

OUTPUT:

Returns an element a in the function field such that this element equals \(a^n\). Raises an error if no such element exists.

See also

is_nth_power()

EXAMPLES:

sage: K.<x> = FunctionField(GF(3))
sage: R.<y> = K[]
sage: L.<y> = K.extension(y^2 - x)                                          # needs sage.rings.function_field
sage: L(y^27).nth_root(27)                                                  # needs sage.rings.function_field
y
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(3)), names=('x',)); (x,) = K._first_ngens(1)
>>> R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(2) - x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.function_field
>>> L(y**Integer(27)).nth_root(Integer(27))                                                  # needs sage.rings.function_field
y
K.<x> = FunctionField(GF(3))
R.<y> = K[]
L.<y> = K.extension(y^2 - x)                                          # needs sage.rings.function_field
L(y^27).nth_root(27)                                                  # needs sage.rings.function_field
poles()[source]

Return the list of the poles of the element.

EXAMPLES:

sage: K.<x> = FunctionField(GF(2))
sage: f = 1/(x^3 + x^2 + x)
sage: f.poles()                                                             # needs sage.libs.pari sage.modules
[Place (x), Place (x^2 + x + 1)]
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(2)), names=('x',)); (x,) = K._first_ngens(1)
>>> f = Integer(1)/(x**Integer(3) + x**Integer(2) + x)
>>> f.poles()                                                             # needs sage.libs.pari sage.modules
[Place (x), Place (x^2 + x + 1)]
K.<x> = FunctionField(GF(2))
f = 1/(x^3 + x^2 + x)
f.poles()                                                             # needs sage.libs.pari sage.modules
sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
sage: (x/y).poles()                                                         # needs sage.rings.finite_rings sage.rings.function_field
[Place (1/x, 1/x*y), Place (x + 1, x*y)]
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> (x/y).poles()                                                         # needs sage.rings.finite_rings sage.rings.function_field
[Place (1/x, 1/x*y), Place (x + 1, x*y)]
K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
(x/y).poles()                                                         # needs sage.rings.finite_rings sage.rings.function_field
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> (x/y).poles()                                                         # needs sage.rings.finite_rings sage.rings.function_field
[Place (1/x, 1/x*y), Place (x + 1, x*y)]
K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
(x/y).poles()                                                         # needs sage.rings.finite_rings sage.rings.function_field
subs(in_dict=None, **kwds)[source]

Substitute the given generators with given values while not touching other generators.

INPUT:

  • in_dict – (optional) dictionary of inputs

  • **kwds – named parameters

OUTPUT: new object if substitution is possible, otherwise self

EXAMPLES:

Basic substitution:

sage: K = GF(7)
sage: Kx.<x> = FunctionField(K)
sage: y = polygen(Kx)
sage: f = x^6 + 3; f
x^6 + 3
>>> from sage.all import *
>>> K = GF(Integer(7))
>>> Kx = FunctionField(K, names=('x',)); (x,) = Kx._first_ngens(1)
>>> y = polygen(Kx)
>>> f = x**Integer(6) + Integer(3); f
x^6 + 3
K = GF(7)
Kx.<x> = FunctionField(K)
y = polygen(Kx)
f = x^6 + 3; f

We also substitute the generators in any base fields:

sage: # needs sage.rings.function_field
sage: K.<x> = FunctionField(QQ)
sage: R.<y> = K[]
sage: L.<y> = K.extension(y^3 - (x^3 + 2*x*y + 1/x))
sage: S.<t> = L[]
sage: M.<t> = L.extension(t^2 - x*y)
sage: f = 7 * t + 3*x*y
sage: f.subs(t=9)
3*x*y + 63
sage: f.subs(x=2, y=4)
7*t + 24
sage: f.subs(t=1, x=2, y=3)
25
>>> from sage.all import *
>>> # needs sage.rings.function_field
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1)
>>> R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(3) - (x**Integer(3) + Integer(2)*x*y + Integer(1)/x), names=('y',)); (y,) = L._first_ngens(1)
>>> S = L['t']; (t,) = S._first_ngens(1)
>>> M = L.extension(t**Integer(2) - x*y, names=('t',)); (t,) = M._first_ngens(1)
>>> f = Integer(7) * t + Integer(3)*x*y
>>> f.subs(t=Integer(9))
3*x*y + 63
>>> f.subs(x=Integer(2), y=Integer(4))
7*t + 24
>>> f.subs(t=Integer(1), x=Integer(2), y=Integer(3))
25
# needs sage.rings.function_field
K.<x> = FunctionField(QQ)
R.<y> = K[]
L.<y> = K.extension(y^3 - (x^3 + 2*x*y + 1/x))
S.<t> = L[]
M.<t> = L.extension(t^2 - x*y)
f = 7 * t + 3*x*y
f.subs(t=9)
f.subs(x=2, y=4)
f.subs(t=1, x=2, y=3)

Because of the possibility of extension fields, a generator to substitute must be specified:

sage: K.<x> = FunctionField(QQ)
sage: f = x
sage: f.subs(2)
Traceback (most recent call last):
...
TypeError: in_dict must be a dict

sage: # needs sage.rings.function_field
sage: R.<y> = K[]
sage: L.<y> = K.extension(y^3 - (x^3 + 2*x*y + 1/x))
sage: f = x + y
sage: f.subs(0)
Traceback (most recent call last):
...
TypeError: in_dict must be a dict
>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1)
>>> f = x
>>> f.subs(Integer(2))
Traceback (most recent call last):
...
TypeError: in_dict must be a dict

>>> # needs sage.rings.function_field
>>> R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(3) - (x**Integer(3) + Integer(2)*x*y + Integer(1)/x), names=('y',)); (y,) = L._first_ngens(1)
>>> f = x + y
>>> f.subs(Integer(0))
Traceback (most recent call last):
...
TypeError: in_dict must be a dict
K.<x> = FunctionField(QQ)
f = x
f.subs(2)
# needs sage.rings.function_field
R.<y> = K[]
L.<y> = K.extension(y^3 - (x^3 + 2*x*y + 1/x))
f = x + y
f.subs(0)

We can also substitute using dictionary syntax:

sage: # needs sage.rings.function_field
sage: K.<x> = FunctionField(QQ)
sage: R.<y> = K[]
sage: L.<y> = K.extension(y^3 - (x^3 + 2*x*y + 1/x))
sage: S.<t> = L[]
sage: M.<t> = L.extension(t^2 - x*y)
sage: f = x + y + t
sage: f.subs({x: 1, y: 3, t: 4})
8
sage: f.subs({x: 1, t: 4})
y + 5
>>> from sage.all import *
>>> # needs sage.rings.function_field
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1)
>>> R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(3) - (x**Integer(3) + Integer(2)*x*y + Integer(1)/x), names=('y',)); (y,) = L._first_ngens(1)
>>> S = L['t']; (t,) = S._first_ngens(1)
>>> M = L.extension(t**Integer(2) - x*y, names=('t',)); (t,) = M._first_ngens(1)
>>> f = x + y + t
>>> f.subs({x: Integer(1), y: Integer(3), t: Integer(4)})
8
>>> f.subs({x: Integer(1), t: Integer(4)})
y + 5
# needs sage.rings.function_field
K.<x> = FunctionField(QQ)
R.<y> = K[]
L.<y> = K.extension(y^3 - (x^3 + 2*x*y + 1/x))
S.<t> = L[]
M.<t> = L.extension(t^2 - x*y)
f = x + y + t
f.subs({x: 1, y: 3, t: 4})
f.subs({x: 1, t: 4})
trace()[source]

Return the trace of the element.

EXAMPLES:

sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^2 - x*y + 4*x^3)                                # needs sage.rings.function_field
sage: y.trace()                                                             # needs sage.rings.function_field
x
>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(2) - x*y + Integer(4)*x**Integer(3), names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.function_field
>>> y.trace()                                                             # needs sage.rings.function_field
x
K.<x> = FunctionField(QQ); R.<y> = K[]
L.<y> = K.extension(y^2 - x*y + 4*x^3)                                # needs sage.rings.function_field
y.trace()                                                             # needs sage.rings.function_field
valuation(place)[source]

Return the valuation of the element at the place.

INPUT:

  • place – a place of the function field

EXAMPLES:

sage: K.<x> = FunctionField(GF(2)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.function_field
sage: p = L.places_infinite()[0]                                            # needs sage.rings.function_field
sage: y.valuation(p)                                                        # needs sage.rings.function_field
-1
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(2)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.function_field
>>> p = L.places_infinite()[Integer(0)]                                            # needs sage.rings.function_field
>>> y.valuation(p)                                                        # needs sage.rings.function_field
-1
K.<x> = FunctionField(GF(2)); _.<Y> = K[]
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.function_field
p = L.places_infinite()[0]                                            # needs sage.rings.function_field
y.valuation(p)                                                        # needs sage.rings.function_field
sage: # needs sage.rings.function_field
sage: K.<x> = FunctionField(QQ); _.<Y> = K[]
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)
sage: O = L.maximal_order()
sage: p = O.ideal(x - 1).place()
sage: y.valuation(p)
0
>>> from sage.all import *
>>> # needs sage.rings.function_field
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)
>>> O = L.maximal_order()
>>> p = O.ideal(x - Integer(1)).place()
>>> y.valuation(p)
0
# needs sage.rings.function_field
K.<x> = FunctionField(QQ); _.<Y> = K[]
L.<y> = K.extension(Y^2 + Y + x + 1/x)
O = L.maximal_order()
p = O.ideal(x - 1).place()
y.valuation(p)
>>> from sage.all import *
>>> # needs sage.rings.function_field
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)
>>> O = L.maximal_order()
>>> p = O.ideal(x - Integer(1)).place()
>>> y.valuation(p)
0
# needs sage.rings.function_field
K.<x> = FunctionField(QQ); _.<Y> = K[]
L.<y> = K.extension(Y^2 + Y + x + 1/x)
O = L.maximal_order()
p = O.ideal(x - 1).place()
y.valuation(p)
zeros()[source]

Return the list of the zeros of the element.

EXAMPLES:

sage: K.<x> = FunctionField(GF(2))
sage: f = 1/(x^3 + x^2 + x)
sage: f.zeros()                                                             # needs sage.libs.pari sage.modules
[Place (1/x)]
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(2)), names=('x',)); (x,) = K._first_ngens(1)
>>> f = Integer(1)/(x**Integer(3) + x**Integer(2) + x)
>>> f.zeros()                                                             # needs sage.libs.pari sage.modules
[Place (1/x)]
K.<x> = FunctionField(GF(2))
f = 1/(x^3 + x^2 + x)
f.zeros()                                                             # needs sage.libs.pari sage.modules
sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
sage: (x/y).zeros()                                                         # needs sage.rings.finite_rings sage.rings.function_field
[Place (x, x*y)]
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> (x/y).zeros()                                                         # needs sage.rings.finite_rings sage.rings.function_field
[Place (x, x*y)]
K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
(x/y).zeros()                                                         # needs sage.rings.finite_rings sage.rings.function_field
>>> from sage.all import *
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> (x/y).zeros()                                                         # needs sage.rings.finite_rings sage.rings.function_field
[Place (x, x*y)]
K.<x> = FunctionField(GF(4)); _.<Y> = K[]                             # needs sage.rings.finite_rings
L.<y> = K.extension(Y^2 + Y + x + 1/x)                                # needs sage.rings.finite_rings sage.rings.function_field
(x/y).zeros()                                                         # needs sage.rings.finite_rings sage.rings.function_field
sage.rings.function_field.element.is_FunctionFieldElement(x)[source]

Return True if x is any type of function field element.

EXAMPLES:

sage: t = FunctionField(QQ,'t').gen()
sage: sage.rings.function_field.element.is_FunctionFieldElement(t)
doctest:warning...
DeprecationWarning: The function is_FunctionFieldElement is deprecated;
use '....parent() in FunctionFields()' instead.
See https://github.com/sagemath/sage/issues/38289 for details.
True
sage: sage.rings.function_field.element.is_FunctionFieldElement(0)
False
>>> from sage.all import *
>>> t = FunctionField(QQ,'t').gen()
>>> sage.rings.function_field.element.is_FunctionFieldElement(t)
doctest:warning...
DeprecationWarning: The function is_FunctionFieldElement is deprecated;
use '....parent() in FunctionFields()' instead.
See https://github.com/sagemath/sage/issues/38289 for details.
True
>>> sage.rings.function_field.element.is_FunctionFieldElement(Integer(0))
False
t = FunctionField(QQ,'t').gen()
sage.rings.function_field.element.is_FunctionFieldElement(t)
sage.rings.function_field.element.is_FunctionFieldElement(0)
sage.rings.function_field.element.make_FunctionFieldElement(parent, element_class, representing_element)[source]

Used for unpickling FunctionFieldElement objects (and subclasses).

EXAMPLES:

sage: from sage.rings.function_field.element import make_FunctionFieldElement
sage: K.<x> = FunctionField(QQ)
sage: make_FunctionFieldElement(K, K.element_class, (x+1)/x)
(x + 1)/x
>>> from sage.all import *
>>> from sage.rings.function_field.element import make_FunctionFieldElement
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1)
>>> make_FunctionFieldElement(K, K.element_class, (x+Integer(1))/x)
(x + 1)/x
from sage.rings.function_field.element import make_FunctionFieldElement
K.<x> = FunctionField(QQ)
make_FunctionFieldElement(K, K.element_class, (x+1)/x)