# Factories to construct function fields#

This module provides factories to construct function fields. These factories are only for internal use.

EXAMPLES:

```sage: K.<x> = FunctionField(QQ); K
Rational function field in x over Rational Field
sage: L.<x> = FunctionField(QQ); L
Rational function field in x over Rational Field
sage: K is L
True
```
```>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); K
Rational function field in x over Rational Field
>>> L = FunctionField(QQ, names=('x',)); (x,) = L._first_ngens(1); L
Rational function field in x over Rational Field
>>> K is L
True
```

AUTHORS:

• William Stein (2010): initial version

• Maarten Derickx (2011-09-11): added `FunctionField_polymod_Constructor`, use `@cached_function`

• Julian Rueth (2011-09-14): replaced `@cached_function` with `UniqueFactory`

class sage.rings.function_field.constructor.FunctionFieldExtensionFactory[source]#

Bases: `UniqueFactory`

Create a function field defined as an extension of another function field by adjoining a root of a univariate polynomial. The returned function field is unique in the sense that if you call this function twice with an equal `polynomial` and `names` it returns the same python object in both calls.

INPUT:

• `polynomial` – univariate polynomial over a function field

• `names` – variable names (as a tuple of length 1 or string)

• `category` – category (defaults to category of function fields)

EXAMPLES:

```sage: K.<x> = FunctionField(QQ)
sage: R.<y> = K[]
sage: y2 = y*1
sage: y2 is y
False
sage: L.<w> = K.extension(x - y^2)                                              # needs sage.rings.function_field
sage: M.<w> = K.extension(x - y2^2)                                             # needs sage.rings.function_field
sage: L is M                                                                    # needs sage.rings.function_field
True
```
```>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1)
>>> R = K['y']; (y,) = R._first_ngens(1)
>>> y2 = y*Integer(1)
>>> y2 is y
False
>>> L = K.extension(x - y**Integer(2), names=('w',)); (w,) = L._first_ngens(1)# needs sage.rings.function_field
>>> M = K.extension(x - y2**Integer(2), names=('w',)); (w,) = M._first_ngens(1)# needs sage.rings.function_field
>>> L is M                                                                    # needs sage.rings.function_field
True
```
create_key(polynomial, names)[source]#

Given the arguments and keywords, create a key that uniquely determines this object.

EXAMPLES:

```sage: K.<x> = FunctionField(QQ)
sage: R.<y> = K[]
sage: L.<w> = K.extension(x - y^2)  # indirect doctest                      # needs sage.rings.function_field
```
```>>> 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(x - y**Integer(2), names=('w',)); (w,) = L._first_ngens(1)# indirect doctest                      # needs sage.rings.function_field
```
create_object(version, key, **extra_args)[source]#

Create the object from the key and extra arguments. This is only called if the object was not found in the cache.

EXAMPLES:

```sage: K.<x> = FunctionField(QQ)
sage: R.<y> = K[]
sage: L.<w> = K.extension(x - y^2)   # indirect doctest                     # needs sage.rings.function_field
sage: y2 = y*1
sage: M.<w> = K.extension(x - y2^2)  # indirect doctest                     # needs sage.rings.function_field
sage: L is M                                                                # needs sage.rings.function_field
True
```
```>>> 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(x - y**Integer(2), names=('w',)); (w,) = L._first_ngens(1)# indirect doctest                     # needs sage.rings.function_field
>>> y2 = y*Integer(1)
>>> M = K.extension(x - y2**Integer(2), names=('w',)); (w,) = M._first_ngens(1)# indirect doctest                     # needs sage.rings.function_field
>>> L is M                                                                # needs sage.rings.function_field
True
```
class sage.rings.function_field.constructor.FunctionFieldFactory[source]#

Bases: `UniqueFactory`

Return the function field in one variable with constant field `F`. The function field returned is unique in the sense that if you call this function twice with the same base field and name then you get the same python object back.

INPUT:

• `F` – field

• `names` – name of variable as a string or a tuple containing a string

EXAMPLES:

```sage: K.<x> = FunctionField(QQ); K
Rational function field in x over Rational Field
sage: L.<y> = FunctionField(GF(7)); L
Rational function field in y over Finite Field of size 7
sage: R.<z> = L[]
sage: M.<z> = L.extension(z^7 - z - y); M                                       # needs sage.rings.finite_rings sage.rings.function_field
Function field in z defined by z^7 + 6*z + 6*y
```
```>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); K
Rational function field in x over Rational Field
>>> L = FunctionField(GF(Integer(7)), names=('y',)); (y,) = L._first_ngens(1); L
Rational function field in y over Finite Field of size 7
>>> R = L['z']; (z,) = R._first_ngens(1)
>>> M = L.extension(z**Integer(7) - z - y, names=('z',)); (z,) = M._first_ngens(1); M                                       # needs sage.rings.finite_rings sage.rings.function_field
Function field in z defined by z^7 + 6*z + 6*y
```
create_key(F, names)[source]#

Given the arguments and keywords, create a key that uniquely determines this object.

EXAMPLES:

```sage: K.<x> = FunctionField(QQ) # indirect doctest
```
```>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1)# indirect doctest
```
create_object(version, key, **extra_args)[source]#

Create the object from the key and extra arguments. This is only called if the object was not found in the cache.

EXAMPLES:

```sage: K.<x> = FunctionField(QQ)  # indirect doctest
sage: L.<x> = FunctionField(QQ)  # indirect doctest
sage: K is L
True
```
```>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1)# indirect doctest
>>> L = FunctionField(QQ, names=('x',)); (x,) = L._first_ngens(1)# indirect doctest
>>> K is L
True
```