Ticket #9054: trac_9054-part2.patch

File trac_9054-part2.patch, 26.1 KB (added by was, 7 years ago)
  • sage/rings/function_field/all.py

    # HG changeset patch
    # User William Stein <wstein@gmail.com>
    # Date 1274923579 25200
    # Node ID c3dd4c08eaefb4782dc8bf946a611bfeb4fe5a82
    # Parent  26b6d3b1b044522b123a231fbde7fd78409b9981
    trac 9054 -- part 2: fully documented function fields; added vector space structure
    
    diff -r 26b6d3b1b044 -r c3dd4c08eaef sage/rings/function_field/all.py
    a b  
    1 from function_field import is_FunctionField, RationalFunctionField
     1from function_field import is_FunctionField
     2from constructor import FunctionField
    23
    34
  • new file sage/rings/function_field/constructor.py

    diff -r 26b6d3b1b044 -r c3dd4c08eaef sage/rings/function_field/constructor.py
    - +  
     1import function_field
     2
     3def FunctionField(X, names=None):
     4    return function_field.RationalFunctionField(X, names=names)
     5   
  • sage/rings/function_field/function_field.py

    diff -r 26b6d3b1b044 -r c3dd4c08eaef sage/rings/function_field/function_field.py
    a b  
    66We create an extension of a rational function fields, and do some
    77simple arithmetic in it::
    88
    9     sage: K.<x> = RationalFunctionField(GF(5^2,'a')); K
     9    sage: K.<x> = FunctionField(GF(5^2,'a')); K
    1010    Rational function field in x over Finite Field in a of size 5^2
    1111    sage: R.<y> = K[]
    1212    sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x)); L
     
    3939"""
    4040
    4141from sage.rings.ring import Field
     42from sage.rings.integer_ring import ZZ
    4243from sage.structure.parent_gens import ParentWithGens
    4344import function_field_element
    4445
    4546from sage.categories.function_fields import FunctionFields
    4647CAT = FunctionFields()
    4748
     49import maps
     50
    4851def is_FunctionField(x):
    4952    """
    5053    Return True if x is of function field type.
    5154
    52     EXAMPLES:
     55    EXAMPLES::
     56   
    5357        sage: from sage.rings.function_field.all import is_FunctionField
    5458        sage: is_FunctionField(QQ)
    5559        False
     60        sage: is_FunctionField(FunctionField(QQ,'t'))
     61        True
    5662    """
    5763    return isinstance(x, FunctionField)
    5864
    5965
    6066class FunctionField(Field):
     67    """
     68    The abstract base class for all function fields.
     69   
     70    EXAMPLES::
     71   
     72        sage: K.<x> = FunctionField(QQ)
     73        sage: isinstance(K, sage.rings.function_field.function_field.FunctionField)
     74        True
     75    """
    6176    def extension(self, f, names=None):
     77        """
     78        Create an extension L = K[y]/(f(y)) of a function field,
     79        defined by a univariate polynomial in one variable over this
     80        function field K.
     81
     82        INPUT:
     83       
     84            - `f` -- a univariate polynomial over self
     85            - ``names`` -- None or string or length-1 tuple
     86
     87        OUTPUT:
     88
     89            - a function field
     90       
     91        EXAMPLES::
     92       
     93            sage: K.<x> = FunctionField(QQ); R.<y> = K[]
     94            sage: K.extension(y^5 - x^3 - 3*x + x*y)
     95            Function field in y defined by y^5 + x*y - x^3 - 3*x
     96        """
    6297        if names is None:
    6398            names = f.variable_name()
    6499        return FunctionField_polymod(f, names)
    65100
    66101class FunctionField_polymod(FunctionField):
     102    """
     103    A function field defined by a univariate polynomial, as an
     104    extension of the base field.
     105   
     106    EXAMPLES::
     107
     108    We make a function field defined by a degree 5 polynomial over the
     109    rational function field over the rational numbers::
     110   
     111        sage: K.<x> = FunctionField(QQ)
     112        sage: R.<y> = K[]
     113        sage: L.<w> = K.extension(y^5 - (x^3 + 2*x*y + 1/x)); L
     114        Function field in w defined by y^5 - 2*x*y + (-x^4 - 1)/x
     115
     116    We next make a function field over the above nontrivial function
     117    field L::
     118
     119        sage: S.<T> = L[]
     120        sage: M.<alpha> = L.extension(T^2 + w*T + y); M
     121        Function field in alpha defined by T^2 + w*T + w
     122        sage: 1/alpha
     123        ((x/(-x^4 - 1))*w^4 - 2*x^2/(-x^4 - 1))*alpha - 1
     124        sage: alpha * (1/alpha)
     125        1
     126
     127    We drill down the tower of function fields::
     128   
     129        sage: M.base_field()
     130        Function field in w defined by y^5 - 2*x*y + (-x^4 - 1)/x
     131        sage: M.base_field().base_field()
     132        Rational function field in x over Rational Field
     133        sage: M.base_field().base_field().constant_field()
     134        Rational Field
     135        sage: M.constant_field()
     136        Rational Field
     137    """
    67138    def __init__(self, polynomial, names, category=CAT):
     139        """
     140        Create a function field defined as an extension of another
     141        function field by adjoining a root of a univariate polynomial.
     142
     143        INPUT:
     144
     145            - ``polynomial`` -- a univariate polynomial over a function field
     146            - ``names`` -- variable names (as a tuple of length 1 or string)
     147            - ``category`` -- a category (defaults to category of function fields)
     148       
     149        EXAMPLES::
     150
     151        We create an extension of function fields::
     152       
     153            sage: K.<x> = FunctionField(QQ); R.<y> = K[]
     154            sage: L = K.extension(y^5 - x^3 - 3*x + x*y); L
     155            Function field in y defined by y^5 + x*y - x^3 - 3*x
     156
     157        Note the type::
     158       
     159            sage: type(L)
     160            <class 'sage.rings.function_field.function_field.FunctionField_polymod_with_category'>
     161
     162        We can set the variable name, which doesn't have to be y::
     163       
     164            sage: L.<w> = K.extension(y^5 - x^3 - 3*x + x*y); L
     165            Function field in w defined by y^5 + x*y - x^3 - 3*x
     166        """
    68167        from sage.rings.polynomial.all import is_Polynomial
     168        if names is None:
     169            names = (polynomial.variable_name(), )
    69170        if not is_Polynomial(polynomial):
    70171            raise TypeError, "polynomial must be a polynomial"
     172        if polynomial.degree() <= 0:
     173            raise ValueError, "polynomial must have positive degree"
    71174        base_field = polynomial.base_ring()
    72175        if not isinstance(base_field, FunctionField):
    73176            raise TypeError, "polynomial must be over a function"
    74177        self._base_field = base_field
    75178        self._polynomial = polynomial
    76         self._free_module = base_field**polynomial.degree()
    77179       
    78180        ParentWithGens.__init__(self, base_field,
    79                                 names=(polynomial.variable_name(),), category = category)
     181                                names=names, category = category)
    80182
    81         self._hash = hash((base_field, polynomial))
     183        self._hash = hash(polynomial)
    82184        self._ring = self._polynomial.parent()
    83185        self._populate_coercion_lists_(coerce_list=[base_field, self._ring])
    84186        self._gen = self(self._ring.gen())
     187
     188    def __hash__(self):
     189        """
     190        Return hash of this function field.
    85191       
     192        EXAMPLES::
     193
     194            sage: K.<x> = FunctionField(QQ); R.<y> = K[]
     195            sage: L = K.extension(y^5 - x^3 - 3*x + x*y); hash(L)
     196            3183366741743088279             # 64-bit
     197            ?                               # 32-bit
     198
     199        """
     200        return self._hash
     201
     202    def constant_field(self):
     203        """
     204        Return the constant field of this function field.  This is
     205        simply the constant field of the base field, which this
     206        function field is a finite extension of.
     207               
     208        EXAMPLES::
     209
     210            sage: K.<x> = FunctionField(QQ)
     211            sage: R.<y> = K[]
     212            sage: L.<w> = K.extension(y^5 - (x^3 + 2*x*y + 1/x)); L
     213            Function field in w defined by y^5 - 2*x*y + (-x^4 - 1)/x
     214            sage: L.constant_field()
     215            Rational Field
     216        """
     217        return self.base_field().constant_field()
     218
     219    def degree(self):
     220        """
     221        Return the degree of this function field over its base
     222        function field.
     223       
     224        EXAMPLES::
     225
     226            sage: K.<x> = FunctionField(QQ)
     227            sage: R.<y> = K[]
     228            sage: L.<w> = K.extension(y^5 - (x^3 + 2*x*y + 1/x)); L
     229            Function field in w defined by y^5 - 2*x*y + (-x^4 - 1)/x
     230            sage: L.degree()
     231            5       
     232        """
     233        return self._polynomial.degree()
    86234       
    87235    def _repr_(self):
     236        """
     237        Return string representation of this function field.
     238       
     239        EXAMPLES::
     240
     241            sage: K.<x> = FunctionField(QQ); R.<y> = K[]
     242            sage: L.<w> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
     243            sage: L._repr_()
     244            'Function field in w defined by y^5 - 2*x*y + (-x^4 - 1)/x'
     245        """
    88246        return "Function field in %s defined by %s"%(self.variable_name(), self._polynomial)
    89247
    90248    def base_field(self):
     249        """
     250        Return the base field of this function field.  This function
     251        field is presented as L = K[y]/(f(y)), and the base field is
     252        by definition the field K.
     253       
     254        EXAMPLES::
     255            sage: K.<x> = FunctionField(QQ); R.<y> = K[]
     256            sage: L.<w> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
     257            sage: L.base_field()
     258            Rational function field in x over Rational Field
     259        """
    91260        return self._base_field
    92261
    93262    def polynomial(self):
     263        """
     264        Return the univariate polynomial that defines this function
     265        field, i.e., the polynomial f(y) so that this function field
     266        is of the form K[y]/(f(y)).
     267       
     268        EXAMPLES::
     269
     270            sage: K.<x> = FunctionField(QQ); R.<y> = K[]
     271            sage: L.<w> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
     272            sage: L.polynomial()
     273            y^5 - 2*x*y + (-x^4 - 1)/x
     274        """
    94275        return self._polynomial
    95276
    96     def free_module(self):
    97         return self._free_module
     277    def polynomial_ring(self):
     278        """
     279        Return the polynomial ring used to represents elements of this
     280        function field.  If we view this function field as being presented
     281        as K[y]/(f(y)), then this function returns the ring K[y].
     282       
     283        EXAMPLES::
    98284
    99     def ring_of_integers(self):
     285            sage: K.<x> = FunctionField(QQ); R.<y> = K[]
     286            sage: L.<w> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
     287            sage: L.polynomial_ring()
     288            Univariate Polynomial Ring in y over Rational function field in x over Rational Field
     289        """
     290        return self._ring
     291
     292    def vector_space(self):
     293        """
     294        Return a vector space V and isomorphisms self --> V and V --> self.
     295
     296        This function allows us to identify the elements of self with
     297        elements of a vector space over the base field, which is
     298        useful for representation and arithmetic with orders, ideals,
     299        etc.
     300       
     301        OUTPUT:
     302
     303            -  ``V`` - a vector space over the rational numbers
     304            -  ``from_V`` - an isomorphism from V to self
     305            -  ``to_V`` - an isomorphism from self to V
     306
     307        EXAMPLES::
     308
     309        We define a function field::
     310       
     311            sage: K.<x> = FunctionField(QQ); R.<y> = K[]
     312            sage: L.<w> = K.extension(y^5 - (x^3 + 2*x*y + 1/x)); L
     313            Function field in w defined by y^5 - 2*x*y + (-x^4 - 1)/x
     314
     315        We get the vector spaces, and maps back and forth::
     316       
     317            sage: V, from_V, to_V = L.vector_space()
     318            sage: V
     319            Vector space of dimension 5 over Rational function field in x over Rational Field
     320            sage: from_V
     321            Isomorphism map:
     322              From: Vector space of dimension 5 over Rational function field in x over Rational Field
     323              To:   Function field in w defined by y^5 - 2*x*y + (-x^4 - 1)/x
     324            sage: to_V
     325            Isomorphism map:
     326              From: Function field in w defined by y^5 - 2*x*y + (-x^4 - 1)/x
     327              To:   Vector space of dimension 5 over Rational function field in x over Rational Field
     328
     329        We convert an element of the vector space back to the function field::
     330       
     331            sage: from_V(V.1)
     332            w
     333
     334        We define an interesting element of the function field::
     335       
     336            sage: a = 1/L.0; a
     337            (-x/(-x^4 - 1))*w^4 + 2*x^2/(-x^4 - 1)
     338
     339        We convert it to the vector space, and get a vector over the base field::
     340       
     341            sage: to_V(a)
     342            (2*x^2/(-x^4 - 1), 0, 0, 0, -x/(-x^4 - 1))
     343
     344        We convert to and back, and get the same element::
     345       
     346            sage: from_V(to_V(a)) == a
     347            True
     348
     349        In the other direction::
     350
     351            sage: v = x*V.0 + (1/x)*V.1
     352            sage: to_V(from_V(v)) == v
     353            True
     354        """
     355        try: return self._vector_space
     356        except AttributeError:
     357            V = self.base_field()**self.degree()
     358            from_V = maps.MapVectorSpaceToFunctionField(V, self)
     359            to_V   = maps.MapFunctionFieldToVectorSpace(self, V)
     360            self._vector_space = (V, from_V, to_V)
     361            return self._vector_space
     362       
     363
     364    def maximal_order(self):
     365        """
     366        Return the maximal_order of self.  If we view self as L =
     367        K[y]/(f(y)), then this is the ring of elements of L that are
     368        integral over K.
     369       
     370        EXAMPLES::
     371
     372        This is not yet implemented...::
     373       
     374            sage: K.<x> = FunctionField(QQ); R.<y> = K[]
     375            sage: L.<w> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
     376            sage: L.maximal_order()
     377            Traceback (most recent call last):
     378            ...
     379            NotImplementedError
     380        """
    100381        raise NotImplementedError
    101382
    102383    def _element_constructor_(self, x):
     
    113394
    114395        TESTS::
    115396
     397            sage: K.<x> = FunctionField(QQ); R.<y> = K[]
     398            sage: L.<w> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
     399            sage: L._element_constructor_(L.polynomial_ring().gen())
     400            w
    116401        """
    117402        if x.parent() is self:
    118403            return x
     
    124409   
    125410
    126411    def gen(self, n=0):
     412        """
     413        Return the n-th generator of this function field.  By default n=0; any other
     414        value of n leads to an error.   The generator is the class of y, if we view
     415        self as being presented as K[y]/(f(y)).
     416       
     417        EXAMPLES::
     418
     419            sage: K.<x> = FunctionField(QQ); R.<y> = K[]
     420            sage: L.<w> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
     421            sage: L.gen()
     422            w
     423            sage: L.gen(1)
     424            Traceback (most recent call last):
     425            ...
     426            IndexError: Only one generator.
     427        """
    127428        if n != 0:
    128429            raise IndexError, "Only one generator."
    129430        return self._gen
    130431
    131432    def ngens(self):
    132         return 1
     433        """
     434        Return the number of generators of this function field over
     435        its base field.  This is by definition 1.
     436       
     437        EXAMPLES::
     438       
     439            sage: K.<x> = FunctionField(QQ); R.<y> = K[]
     440            sage: L.<w> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
     441            sage: L.ngens()
     442            1
     443        """
     444        return ZZ(1)
    133445
    134446    def equation_order(self):
     447        """
     448        If we view self as being presented as K[y]/(f(y)), then this
     449        function returns the order generated by the class of y.
     450       
     451        EXAMPLES::
     452
     453            sage: K.<x> = FunctionField(QQ); R.<y> = K[]
     454            sage: L.<w> = K.extension(y^5 - (x^3 + 2*x*y + 1/x))
     455            sage: L.equation_order()
     456            Traceback (most recent call last):
     457            ...
     458            NotImplementedError
     459        """
    135460        raise NotImplementedError
    136461
    137462class RationalFunctionField(FunctionField):
    138     def __init__(self, base_field, names, category=CAT):
    139         if not base_field.is_field():
    140             raise TypeError, "base_field must be a field"
    141         ParentWithGens.__init__(self, base_field, names=names, category = category)
    142         R = base_field[names[0]]
    143         self._hash = hash((base_field, names))
    144         self._base_field = base_field
     463    """
     464    A rational function field K(t) in one variable, over an arbitrary
     465    base field.
     466   
     467    EXAMPLES::
     468
     469        sage: K.<t> = FunctionField(GF(3)); K
     470        Rational function field in t over Finite Field of size 3
     471        sage: K.gen()
     472        t
     473        sage: 1/t + t^3 + 5
     474        (t^4 + 2*t + 1)/t
     475
     476    There are various ways to get at the underlying fields and rings
     477    associated to a rational function field::
     478
     479        sage: K.<t> = FunctionField(GF(7))
     480        sage: K.base_field()
     481        Rational function field in t over Finite Field of size 7
     482        sage: K.field()
     483        Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7
     484        sage: K.constant_field()
     485        Finite Field of size 7
     486        sage: K.maximal_order()
     487        Univariate Polynomial Ring in t over Finite Field of size 7
     488    """
     489    def __init__(self, constant_field, names, category=CAT):
     490        """
     491        Create a rational function field in one variable.
     492
     493        INPUT:
     494
     495            - ``constant_field`` -- an arbitrary field
     496            - ``names`` -- a string or tuple of length 1
     497            - ``category`` -- default: FunctionFields()
     498       
     499        EXAMPLES::
     500
     501            sage: K.<t> = FunctionField(CC); K
     502            Rational function field in t over Complex Field with 53 bits of precision
     503            sage: K.category()
     504            Category of function fields
     505            sage: FunctionField(QQ[I], 'alpha')
     506            Rational function field in alpha over Number Field in I with defining polynomial x^2 + 1
     507
     508        Must be over a field::
     509       
     510            sage: FunctionField(ZZ)
     511            Traceback (most recent call last):
     512            ...
     513            TypeError: constant_field must be a field
     514        """
     515        if not constant_field.is_field():
     516            raise TypeError, "constant_field must be a field"
     517        ParentWithGens.__init__(self, self, names=names, category = category)
     518        R = constant_field[names[0]]
     519        self._hash = hash((constant_field, names))
     520        self._constant_field = constant_field
    145521        self._ring = R
    146522        self._field = R.fraction_field()
    147         self._populate_coercion_lists_(coerce_list=[base_field])
     523        self._populate_coercion_lists_(coerce_list=[self._field])
    148524        self._gen = self(R.gen())
    149525
    150526    def __hash__(self):
     527        """
     528        Return hash of this function field.
     529
     530        EXAMPLES::
     531       
     532            sage: K.<t> = FunctionField(QQ)
     533            sage: hash(K)
     534            502145503910697533              # 64-bit
     535            ?                               # 32-bit           
     536        """
    151537        return self._hash
    152538
    153539    def _repr_(self):
     540        """
     541        Return string representation of this function field.
     542       
     543        EXAMPLES::
     544       
     545            sage: K.<t> = FunctionField(QQ)
     546            sage: K._repr_()
     547            'Rational function field in t over Rational Field'
     548        """
    154549        return "Rational function field in %s over %s"%(
    155             self.variable_name(), self._base_field)
     550            self.variable_name(), self._constant_field)
    156551
    157552    def _element_constructor_(self, x):
    158553        r"""
    159         Make x into an element of this function field, possibly not canonically.
     554        Coerce x into an element of this function field, possibly not canonically.
    160555
    161556        INPUT:
    162557       
     
    166561       
    167562            ``x``, as an element of this function field
    168563
    169         TESTS::
    170 
     564        EXAMPLES::
     565       
     566            sage: K.<t> = FunctionField(QQ)
     567            sage: a = K._element_constructor_(K.maximal_order().gen()); a
     568            t
     569            sage: a.parent()
     570            Rational function field in t over Rational Field
    171571        """
    172572        if x.parent() is self._field:
    173573            return function_field_element.FunctionFieldElement_P1(self, x)
     
    179579                raise TypeError
    180580        return function_field_element.FunctionFieldElement_P1(self, self._field(x))
    181581
     582    def degree(self):
     583        """
     584        Return the degree over the base field of this rational
     585        function field, which is 1.
     586       
     587        EXAMPLES::
     588       
     589            sage: K.<t> = FunctionField(QQ)
     590            sage: K.degree()
     591            1
     592        """
     593        return ZZ(1)
     594   
    182595    def gen(self, n=0):
     596        """
     597        Return the n-th generator of this function field.  If n is not
     598        0, then an IndexError is raised.
     599
     600        EXAMPLES::
     601           
     602            sage: K.<t> = FunctionField(QQ); K.gen()
     603            t
     604            sage: K.gen().parent()
     605            Rational function field in t over Rational Field
     606            sage: K.gen(1)
     607            Traceback (most recent call last):
     608            ...
     609            IndexError: Only one generator.
     610        """
    183611        if n != 0:
    184612            raise IndexError, "Only one generator."
    185613        return self._gen
    186614
    187615    def ngens(self):
    188         return 1
     616        """
     617        Return the number of generators, which is 1.
     618       
     619        EXAMPLES::
     620
     621            sage: K.<t> = FunctionField(QQ)
     622            sage: K.ngens()
     623            1
     624        """
     625        return ZZ(1)
    189626   
    190627    def base_field(self):
    191         return self._base_field
     628        """
     629        Return the base field of this rational function field, which is just
     630        this function field itself.
     631       
     632        EXAMPLES::
     633       
     634            sage: K.<t> = FunctionField(GF(7))
     635            sage: K.base_field()
     636            Rational function field in t over Finite Field of size 7
     637        """
     638        return self
    192639
    193     def ring_of_integers(self):
     640    def field(self):
     641        """
     642        Return the underlying field, forgetting the function field
     643        structure.
     644       
     645        EXAMPLES::
     646
     647            sage: K.<t> = FunctionField(GF(7))
     648            sage: K.field()
     649            Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7
     650        """
     651        return self._field
     652
     653    def maximal_order(self):
     654        """
     655        Return the maximal order of this function field.  Since this
     656        is a rational function field it is of the form K(t), and the
     657        maximal order is by definition K[t].
     658       
     659        EXAMPLES::
     660       
     661            sage: K.<t> = FunctionField(QQ)
     662            sage: K.maximal_order()
     663            Univariate Polynomial Ring in t over Rational Field
     664        """
    194665        return self._ring
    195666
    196     def field(self):
    197         return self._field
     667    def constant_field(self):
     668        """
     669        Return the field that this rational function field is a
     670        transcendental extension of.
     671
     672        EXAMPLES::
     673
     674            sage: K.<t> = FunctionField(QQ)
     675            sage: K.constant_field()
     676            Rational Field
     677        """
     678        return self._constant_field
    198679
    199680
    200681
  • sage/rings/function_field/function_field_element.py

    diff -r 26b6d3b1b044 -r c3dd4c08eaef sage/rings/function_field/function_field_element.py
    a b  
    99        self._x = x
    1010
    1111    def _repr_(self):
    12         return repr(self._x)
     12        return self._x._repr(name=self.parent().variable_name())
    1313       
    1414    def __nonzero__(self):
    1515        return self._x.__nonzero__()
     
    3434    def __invert__(self):
    3535        P = self.parent()
    3636        return P(self._x.xgcd(P._polynomial)[1])
    37    
     37
     38    def list(self):
     39        return self._x.padded_list(self.parent().degree())
     40       
    3841
    3942class FunctionFieldElement_P1(FunctionFieldElement):
    4043    def __init__(self, parent, x):
    4144        FieldElement.__init__(self, parent)
    4245        self._x = x
    4346
     47    def list(self):
     48        return [self]
     49
    4450    def _repr_(self):
    4551        return repr(self._x)
    4652       
  • new file sage/rings/function_field/maps.py

    diff -r 26b6d3b1b044 -r c3dd4c08eaef sage/rings/function_field/maps.py
    - +  
     1r"""
     2
     3"""
     4
     5from sage.categories.map import Map
     6from sage.categories.homset import Hom
     7
     8class FunctionFieldIsomorphism(Map):
     9    r"""
     10    A base class for various isomorphisms between function fields and
     11    vector spaces.
     12    """
     13    def _repr_type(self):
     14        return "Isomorphism"
     15
     16    def is_injective(self):
     17        return True
     18
     19    def is_surjective(self):
     20        return True
     21
     22class MapVectorSpaceToFunctionField(FunctionFieldIsomorphism):
     23    r"""
     24    EXAMPLES:
     25
     26    """
     27    def __init__(self, V, K):
     28        self._V = V
     29        self._K = K
     30        self._R = K.polynomial_ring()
     31        FunctionFieldIsomorphism.__init__(self, Hom(V, K))
     32
     33    def _call_(self, v):
     34        f = self._R(self._V(v).list())
     35        return self._K(f)
     36
     37    def domain(self):
     38        return self._V
     39
     40    def codomain(self):
     41        return self._K
     42
     43class MapFunctionFieldToVectorSpace(Map):
     44    def __init__(self, K, V):
     45        self._V = V
     46        self._K = K
     47        self._zero = K.base_ring()(0)
     48        self._n = K.degree()
     49        FunctionFieldIsomorphism.__init__(self, Hom(K, V))
     50
     51    def domain(self):
     52        return self._K
     53
     54    def codomain(self):
     55        return self._V
     56
     57    def _repr_type(self):
     58        return "Isomorphism"
     59   
     60    def _call_(self, x):
     61        y = self._K(x)
     62        v = y.list()
     63        w = v + [self._zero]*(self._n - len(v))
     64        return self._V(w)
  • new file sage/rings/function_field/todo.txt

    diff -r 26b6d3b1b044 -r c3dd4c08eaef sage/rings/function_field/todo.txt
    - +  
     1
     2[ ] conversion back and forth between a free module over base
     3
     4[ ] Docstring headers for each file with description of content of file
     5
     6[ ] copyright headers
     7
     8[ ] polynomial factoring of any univariate poly over a function field: reduce to bivariate over constant field?
     9
     10[ ] checking irreducibility in FunctionField_polymod constructor
     11
     12[ ] pickle doctests
     13
     14[ ] TestSuite(s).run() doctests
     15
     16[ ] ideals
     17
     18[ ] non-monic defining polynomials
     19
     20[ ] 100% coverage
     21
     22[ ] matrix of element
     23
     24[ ] norm
     25
     26[ ] trace
     27
     28[ ] a command FunctionField to make a new function field from anything.
     29
     30[ ] method function_field() on algebraic curves, that give back a corresponding function field object.
     31
     32[ ]