Ticket #9054: trac_9054-part8.patch

File trac_9054-part8.patch, 25.8 KB (added by was, 7 years ago)

ideals and orders!

  • sage/matrix/matrix2.pyx

    # HG changeset patch
    # User William Stein <wstein@gmail.com>
    # Date 1275028095 25200
    # Node ID 10779925917f5495f8676539c674099bc6eef9c2
    # Parent  11bc1c46e91ccbbfc86b09685a8fe0d7ef1a8d4e
    trac 9054 (part 8): work on ideals and orders; in particular got basic capabilities all working and fix lots of linear algebra
    
    diff -r 11bc1c46e91c -r 10779925917f sage/matrix/matrix2.pyx
    a b  
    42764276        else:
    42774277            try:
    42784278                a, d, p = self._echelon_form_PID()
    4279             except TypeError:
    4280                 raise NotImplementedError, "echelon form over %s not yet implemented"%self.base_ring()
     4279            except TypeError, msg:
     4280                raise NotImplementedError, "%s\nechelon form over %s not yet implemented"%(msg, self.base_ring())
    42814281
    42824282            for c from 0 <= c < self.ncols():
    42834283               for r from 0 <= r < self.nrows():
     
    44034403                    kwds['algorithm'] = algorithm
    44044404                return self._echelonize_ring(**kwds)
    44054405        except ArithmeticError, msg:
    4406             raise NotImplementedError, "Echelon form not implemented over '%s'."%self.base_ring()
     4406            raise NotImplementedError, "%s\nEchelon form not implemented over '%s'."%(msg,self.base_ring())
    44074407
    44084408    def echelon_form(self, algorithm="default", cutoff=0, **kwds):
    44094409        """
     
    70087008        if a[k,0] not in I:
    70097009            try:
    70107010                v = R.ideal(a[0,0], a[k,0]).gens_reduced()
    7011             except:
    7012                 raise ArithmeticError, "Can't create ideal on %s and %s" % (a[0,0], a[k,0])
     7011            except Exception, msg:
     7012                raise ArithmeticError, "%s\nCan't create ideal on %s and %s" % (msg, a[0,0], a[k,0])
    70137013            if len(v) > 1:
    70147014                raise ArithmeticError, "Ideal %s not principal" %  R.ideal(a[0,0], a[k,0])
    70157015            B = v[0]
  • sage/modules/free_module.py

    diff -r 11bc1c46e91c -r 10779925917f sage/modules/free_module.py
    a b  
    48054805        """
    48064806        if len(B) == 0:
    48074807            return 1
    4808         d = sage.rings.integer.Integer(B[0].denominator())
     4808        d = B[0].denominator()
    48094809        for x in B[1:]:
    48104810            d = d.lcm(x.denominator())
    48114811        return d
  • sage/rings/function_field/function_field.py

    diff -r 11bc1c46e91c -r 10779925917f sage/rings/function_field/function_field.py
    a b  
    204204            return True
    205205        return False
    206206
    207     def _factor_univariate_polynomial(self, f):
    208         raise NotImplementedError
    209 
    210207class FunctionField_polymod(FunctionField):
    211208    """
    212209    A function field defined by a univariate polynomial, as an
     
    694691            return function_field_element.FunctionFieldElement_rational(self, x)
    695692        if isinstance(x, function_field_element.FunctionFieldElement):
    696693            return function_field_element.FunctionFieldElement_rational(self, self._field(x.element()))
     694        if x.parent() is self.polynomial_ring():
     695            return x[0]
    697696        return function_field_element.FunctionFieldElement_rational(self, self._field(x))
    698697
    699698    # nonoptimized
     
    784783        from sage.structure.factorization import Factorization
    785784        return Factorization(w, unit=unit)
    786785
    787     def polynomial_ring(self):
     786    def polynomial_ring(self, var='x'):
    788787        """
    789         Return polynomial ring underlying this function field.
     788        Return polynomial ring K[var] that could be used to represent
     789        elements of self, if self were viewed as K[var]/(var).
    790790       
    791791        EXAMPLES::
    792792       
    793793            sage: K.<x> = FunctionField(QQ)
    794794            sage: K.polynomial_ring()
    795             Univariate Polynomial Ring in x over Rational Field
     795            Univariate Polynomial Ring in x over Rational function field in x over Rational Field
     796            sage: K.polynomial_ring('T')
     797            Univariate Polynomial Ring in T over Rational function field in x over Rational Field
    796798        """
    797         return self._ring
     799        if var != 'x': return self[var]
     800        try: return self._polynomial_ring
     801        except AttributeError:
     802            self._polynomial_ring = self[var]
     803            return self._polynomial_ring
    798804
    799805    def vector_space(self):
    800806        """
  • sage/rings/function_field/function_field_element.pyx

    diff -r 11bc1c46e91c -r 10779925917f sage/rings/function_field/function_field_element.pyx
    a b  
    488488            t^2 - 1/3
    489489        """
    490490        return self._x.denominator()
     491
     492    def factor(self):
     493        """
     494        Factor this rational function.
     495       
     496        EXAMPLES::
     497
     498            sage: K.<t> = FunctionField(QQ)
     499            sage: f = (t+1) / (t^2 - 1/3)
     500            sage: f.factor()
     501            (t + 1) * (t^2 - 1/3)^-1
     502            sage: (7*f).factor()
     503            (7) * (t + 1) * (t^2 - 1/3)^-1
     504            sage: ((7*f).factor()).unit()
     505            7
     506            sage: (f^3).factor()
     507            (t + 1)^3 * (t^2 - 1/3)^-3
     508        """
     509        P = self.parent()
     510        F = self._x.factor()
     511        from sage.structure.factorization import Factorization
     512        return Factorization([(P(a),e) for a,e in F], unit=F.unit())
     513
     514    def inverse_mod(self, I):
     515        r"""
     516        Return an inverse of self modulo the integral ideal `I`, if
     517        defined, i.e., if `I` and self together generate the unit
     518        ideal.
     519
     520        EXAMPLES::
     521
     522            sage: R.<x> = FunctionField(QQ)
     523            sage: S = R.maximal_order(); I = S.ideal(x^2+1)
     524            sage: t = S(x+1).inverse_mod(I); t
     525            -1/2*x + 1/2
     526            sage: (t*(x+1) - 1) in I
     527            True           
     528        """
     529        f = I.gens()[0]._x
     530        assert f.denominator() == 1
     531        assert self._x.denominator() == 1
     532        return self.parent()(self._x.numerator().inverse_mod(f.numerator()))
  • sage/rings/function_field/function_field_ideal.py

    diff -r 11bc1c46e91c -r 10779925917f sage/rings/function_field/function_field_ideal.py
    a b  
    55    A fractional ideal of a function field.
    66
    77    EXAMPLES::
     8
     9        sage: R.<x> = FunctionField(GF(7))
     10        sage: S = R.maximal_order(); I = S.ideal(x^3+1)
     11        sage: isinstance(I, sage.rings.function_field.function_field_ideal.FunctionFieldIdeal)
     12        True   
    813    """
    914    pass
    1015
     
    1217    """
    1318    A fractional ideal specified by a finitely generated module over
    1419    the integers of the base field.
     20
     21    EXAMPLES::
     22
     23    An ideal in a rational function field::
     24
     25        sage: R.<x> = FunctionField(QQ); S.<y> = R[]
     26        sage: L.<y> = R.extension(y^2 - x^3 - 1); M = L.equation_order()   
     27        sage: I = M.ideal(y)
     28        sage: I
     29        Ideal (x^3 + 1, -y) of Order in Function field in y defined by y^2 - x^3 - 1
     30        sage: I^2
     31        Ideal (x^3 + 1, (-x^3 - 1)*y) of Order in Function field in y defined by y^2 - x^3 - 1   
    1532    """
    16     def __init__(self, field, module):
     33    def __init__(self, ring, module):
    1734        """
    1835        INPUT:
    1936
    20             - ``field`` -- a function field
     37            - ``ring`` -- an order in a function field
    2138            - ``module`` -- a module
     39
     40        EXAMPLES::
     41
     42            sage: R.<x> = FunctionField(QQ); S.<y> = R[]
     43            sage: L.<y> = R.extension(y^2 - x^3 - 1); M = L.equation_order()   
     44            sage: I = M.ideal(y)
     45            sage: type(I)
     46            <class 'sage.rings.function_field.function_field_ideal.FunctionFieldIdeal_module'>
    2247        """
    23         self._field = field
     48        self._ring = ring
    2449        self._module = module
    25         V, from_V, to_V = field.vector_space()
     50        self._structure = ring.fraction_field().vector_space()
     51        V, from_V, to_V = self._structure
    2652        gens = tuple([from_V(a) for a in module.basis()])
    27         Ideal_generic.__init__(self, field, gens, coerce=False)
     53        Ideal_generic.__init__(self, ring, gens, coerce=False)
    2854
    29     def gens(self):
     55    def __contains__(self, x):
    3056        """
     57        Return True if x is in this ideal.
     58
    3159        EXAMPLES::
     60
     61            sage: R.<x> = FunctionField(GF(7)); S.<y> = R[]
     62            sage: L.<y> = R.extension(y^2 - x^3 - 1); M = L.equation_order()
     63            sage: I = M.ideal_with_gens_over_base([1, y]);  I
     64            Ideal (1, y) of Order in Function field in y defined by y^2 + 6*x^3 + 6
     65            sage: y in I
     66            True
     67            sage: y/x in I
     68            False
     69            sage: y^2 - 2 in I
     70            True
    3271        """
    33         self._gens
     72        return self._structure[2](x) in self._module
    3473
    35     def _repr_(self):
     74    def module(self):
    3675        """
     76        Return module over the maximal order of the base field that
     77        underlies self.
     78
     79        The formation of this module is compatible with the vector
     80        space corresponding to the function field.
     81
     82        OUTPUT:
     83
     84            - a module over the maximal order of the base field of self
     85
    3786        EXAMPLES::
     87
     88            sage: R.<x> = FunctionField(GF(7))
     89            sage: S = R.maximal_order(); S
     90            Maximal order in Rational function field in x over Finite Field of size 7
     91            sage: R.polynomial_ring()
     92            Univariate Polynomial Ring in x over Rational function field in x over Finite Field of size 7
     93            sage: I = S.ideal_with_gens_over_base([x^2 + 1, x*(x^2+1)])
     94            sage: I.gens()
     95            (x^2 + 1,)
     96            sage: I.module()
     97            Free module of degree 1 and rank 1 over Maximal order in Rational function field in x over Finite Field of size 7
     98            User basis matrix:
     99            [x^2 + 1]
     100            sage: V, from_V, to_V = R.vector_space(); V
     101            Vector space of dimension 1 over Rational function field in x over Finite Field of size 7
     102            sage: I.module().is_submodule(V)
     103            True       
    38104        """
    39         return "Fractional ideal of %s defined by %s"%(self._field, self._module)
     105        return self._module
    40106
     107    def __add__(self, other):
     108        """
     109        Add together two ideals.
     110       
     111        EXAMPLES::
     112       
     113            sage: R.<x> = FunctionField(GF(7)); S.<y> = R[]
     114            sage: L.<y> = R.extension(y^2 - x^3 - 1); M = L.equation_order()   
     115            sage: I = M.ideal(y); J = M.ideal(y+1)
     116            sage: Z = I + J; Z
     117            Ideal (y + 1, 6*y) of Order in Function field in y defined by y^2 + 6*x^3 + 6
     118            sage: 1 in Z
     119            True
     120            sage: M.ideal(y^2) + M.ideal(y^3) == M.ideal(y^2,y^3)
     121            True
     122        """
     123        if not isinstance(other, FunctionFieldIdeal_module):
     124            other = self.ring().ideal(other)
     125        return FunctionFieldIdeal_module(self.ring(), self.module() + other.module())
    41126
    42 def ideal_with_gens(K, gens, check):
     127    def intersection(self, other):
     128        """
     129        Return the intersection of the ideals self and other.
     130       
     131        EXAMPLES::
     132
     133            sage: R.<x> = FunctionField(GF(7)); S.<y> = R[]
     134            sage: L.<y> = R.extension(y^2 - x^3 - 1); M = L.equation_order()   
     135            sage: I = M.ideal(y^3); J = M.ideal(y^2)
     136            sage: Z = I.intersection(J); Z
     137            Ideal (6*x^6 + 5*x^3 + 6, (6*x^3 + 6)*y) of Order in Function field in y defined by y^2 + 6*x^3 + 6
     138            sage: y^2 in Z
     139            False
     140            sage: y^3 in Z
     141            True
     142        """
     143        if not isinstance(other, FunctionFieldIdeal_module):
     144            other = self.ring().ideal(other)
     145        if self.ring() != other.ring():
     146            raise ValueError, "rings must be the same"
     147        return FunctionFieldIdeal_module(self.ring(), self.module().intersection(other.module()))
     148
     149    def __cmp__(self, other):
     150        """
     151        Compare self and other.
     152       
     153        EXAMPLES::
     154
     155            sage: R.<x> = FunctionField(GF(7)); S.<y> = R[]
     156            sage: L.<y> = R.extension(y^2 - x^3 - 1)
     157            sage: M = L.equation_order()   
     158            sage: I = M.ideal(y*(y+1)); J = M.ideal((y^2-2)*(y+1))
     159            sage: I+J == J+I            # indirect test
     160            True
     161            sage: I == J
     162            False
     163            sage: I < J
     164            True
     165            sage: J < I
     166            False       
     167        """
     168        if not isinstance(other, FunctionFieldIdeal_module):
     169            other = self.ring().ideal(other)
     170        if self.ring() != other.ring():
     171            raise ValueError, "rings must be the same"
     172        return cmp(self.module(), other.module())
     173
     174    def __invert__(self):
     175        """
     176        Return the inverse of this fractional ideal.
     177        """
     178        # If I is this fractional ideal, then the inverse
     179        # of I is the set of elements x such that x*I is
     180        # in the unit ideal.  Our straightforward algorithm to
     181        # compute this is to take the homomorphism defined
     182        # by multiplication by generators of self, and compute
     183        # the inverse image something under it.
     184       
     185       
     186
     187def ideal_with_gens(R, gens):
    43188    """
    44     Return ideal in the maximal order of K with given generators.
     189    Return fractional ideal in the order of R with given generators
     190    over R.
    45191
    46192    EXAMPLES::
     193
     194        sage: R.<x> = FunctionField(QQ); S.<y> = R[]
     195        sage: L.<y> = R.extension(y^2 - x^3 - 1); M = L.equation_order()   
     196        sage: sage.rings.function_field.function_field_ideal.ideal_with_gens(M, [y])
     197        Ideal (x^3 + 1, -y) of Order in Function field in y defined by y^2 - x^3 - 1
    47198    """
    48     raise NotImplementedError
     199    return ideal_with_gens_over_base(R, [b*g for b in R.basis() for g in gens])
     200   
    49201
    50 def ideal_with_basis(K, basis, check):
     202def ideal_with_gens_over_base(R, gens):
    51203    """
    52     Return ideal in the maximal order of K with given basis over the
    53     base field.
     204    Return fractional ideal in the given order R with given generators
     205    over the maximal order of the base field.
    54206
    55207    EXAMPLES::
     208
     209        sage: R.<x> = FunctionField(QQ); S.<y> = R[]
     210        sage: L.<y> = R.extension(y^2 - x^3 - 1); M = L.equation_order()   
     211        sage: sage.rings.function_field.function_field_ideal.ideal_with_gens_over_base(M, [x^3+1,-y])
     212        Ideal (x^3 + 1, -y) of Order in Function field in y defined by y^2 - x^3 - 1   
    56213    """
     214    K = R.fraction_field()
    57215    V, from_V, to_V = K.vector_space()
    58     R = V.base_field().maximal_order()
    59     M = V.span([to_V(b) for b in basis], base_ring=R)
    60     return FunctionFieldIdeal_module(K, M)
     216
     217    # We handle the case of a rational function field separately,
     218    # since this is the base case and is used, e.g,. internally
     219    # by the linear algebra Hermite form code.
     220    import function_field_order
     221    if isinstance(R, function_field_order.FunctionFieldOrder_rational):
     222        try:
     223            v = R._ring.ideal([x.element() for x in gens]).gens_reduced()
     224            assert len(v) == 1
     225            basis = [to_V(v[0])]
     226            M = V.span_of_basis(basis, check=False, already_echelonized=True, base_ring=R)
     227        except Exception, msg:
     228            print msg   # TODO --for debugging
     229            raise
     230    else:
     231        # General case
     232        S = V.base_field().maximal_order()
     233        M = V.span([to_V(b) for b in gens], base_ring=S)
     234
     235    return FunctionFieldIdeal_module(R, M)
  • sage/rings/function_field/function_field_order.py

    diff -r 11bc1c46e91c -r 10779925917f sage/rings/function_field/function_field_order.py
    a b  
    66
    77from sage.rings.ring import IntegralDomain, PrincipalIdealDomain
    88
     9from sage.rings.ideal import is_Ideal
     10
    911class FunctionFieldOrder(IntegralDomain):
    1012    def __init__(self, fraction_field):
    1113        """
     
    3537        """
    3638        return False
    3739
    38     def is_field(self):
     40    def is_field(self, proof=True):
    3941        """
    4042        EXAMPLES::
    4143
     
    4446        """
    4547        return False
    4648
     49    def is_noetherian(self):
     50        """
     51        Return True, since orders in function fields are noetherian.
     52       
     53        EXAMPLES::
     54
     55            sage: FunctionField(QQ,'y').maximal_order().is_noetherian()
     56            True
     57        """
     58        return True
     59
    4760    def fraction_field(self):
    4861        """
    4962        EXAMPLES::
     
    5366        """
    5467        return self._fraction_field
    5568
    56     def ideal_with_basis(self, basis, check=True):
     69    def ideal_with_gens_over_base(self, gens):
    5770        """
    58         Return the ideal with given generators.
     71        Return the fractional ideal with given generators over the
     72        maximal ideal of the base field.  That this is really an ideal
     73        is not checked.
    5974
    6075        INPUT:
     76
    6177            - ``basis`` -- list of elements that are a basis for the
    6278              ideal over the maximal order of the base field
    63             - ``check`` -- bool (default: True)
    6479           
    6580        EXAMPLES::
    6681
     82        We construct an ideal in a rational function field::
     83       
    6784            sage: R.<y> = FunctionField(QQ)
    6885            sage: S = R.maximal_order()
    69             sage: I = S.ideal_with_basis([y])
    70             ?
     86            sage: I = S.ideal_with_gens_over_base([y]); I
     87            Ideal (y) of Maximal order in Rational function field in y over Rational Field
     88            sage: I*I
     89            Ideal (y^2) of Maximal order in Rational function field in y over Rational Field
     90
     91        We construct some ideals in a nontrivial function field::
     92
     93            sage: R.<x> = FunctionField(GF(7)); S.<y> = R[]
     94            sage: L.<y> = R.extension(y^2 - x^3 - 1)
     95            sage: M = L.equation_order(); M
     96            Order in Function field in y defined by y^2 + 6*x^3 + 6
     97            sage: I = M.ideal_with_gens_over_base([1, y]);  I
     98            Ideal (1, y) of Order in Function field in y defined by y^2 + 6*x^3 + 6
     99            sage: I.module()
     100            Free module of degree 2 and rank 2 over Maximal order in Rational function field in x over Finite Field of size 7
     101            Echelon basis matrix:
     102            [1 0]
     103            [0 1]
    71104        """
    72         from function_field_ideal import ideal_with_basis
    73         return ideal_with_basis(self.fraction_field(), [self(a) for a in basis], check=check)
     105        from function_field_ideal import ideal_with_gens_over_base
     106        return ideal_with_gens_over_base(self, [self(a) for a in gens])
    74107
    75     def TODOideal(self, x, check=True):
     108    def ideal(self, *gens):
    76109        """
    77         Return the ideal generated by the element x or the elements in
    78         x if x is a list.
     110        Return the fractional ideal generated by the element gens or
     111        the elements in gens if gens is a list.
    79112
    80113        EXAMPLES::
    81114
    82115            sage: R.<y> = FunctionField(QQ)
    83116            sage: S = R.maximal_order()
    84117            sage: S.ideal(y)
    85            
     118            Ideal (y) of Maximal order in Rational function field in y over Rational Field
     119
     120        A fractional ideal of a nontrivial extension::
     121
     122            sage: R.<x> = FunctionField(GF(7)); S.<y> = R[]
     123            sage: L.<y> = R.extension(y^2 - x^3 - 1)
     124            sage: M = L.equation_order()
     125            sage: M.ideal(1/y)
     126            Ideal (1, (6/(x^3 + 1))*y) of Order in Function field in y defined by y^2 + 6*x^3 + 6       
    86127        """
     128        if len(gens) == 1:
     129            gens = gens[0]
     130            if not isinstance(gens, (list, tuple)):
     131                gens = [gens]
    87132        from function_field_ideal import ideal_with_gens
    88         return ideal_with_gens(self, x, check=check)
     133        return ideal_with_gens(self, gens)
     134
     135
     136       
    89137   
    90138
    91139class FunctionFieldOrder_basis(FunctionFieldOrder):
     
    116164        V, fr, to = fraction_field.vector_space()
    117165        R = fraction_field.base_field().maximal_order()
    118166        self._module = V.span([to(b) for b in basis], base_ring=R)
     167        self._ring = fraction_field.polynomial_ring()
     168        self._populate_coercion_lists_(coerce_list=[self._ring])
    119169        if check:
    120170            if self._module.rank() != fraction_field.degree():
    121171                raise ValueError, "basis is not a basis"
    122172        IntegralDomain.__init__(self, self, names = fraction_field.variable_names(), normalize = False)
    123173
     174    def _element_constructor_(self, f):
     175        """
     176        EXAMPLES::
     177
     178            sage: R.<y> = FunctionField(QQ)
     179            sage: R.maximal_order()._element_constructor_(y)
     180            y
     181        """
     182        # HUGE TODO: have to check that f is really in self!!
     183        if f.parent() is self.fraction_field():
     184            f = f.element()
     185        elif f.parent() is self._ring:
     186            return function_field_element.FunctionFieldElement_rational(self, f)
     187        return function_field_element.FunctionFieldElement_rational(self, self._ring(f))
     188
    124189    def fraction_field(self):
    125190        """
    126191        EXAMPLES::
     
    138203            sage: K.<x> = FunctionField(GF(7)); R.<y> = K[]; L.<Y> = K.extension(y^4 + x*y + 4*x + 1); S = L.equation_order()           
    139204            sage: S.basis()
    140205            (1, Y, Y^2, Y^3)
    141 
    142206        """
    143207        return self._basis
    144208
     
    157221        """
    158222        return self._module
    159223
     224##     def polynomial_quotient_ring(self):
     225##         """
     226##         Return a quotient of a (possibly multivariate) polynomial ring
     227##         that is isomorphic to self, along with morphisms back and
     228##         forth.
     229##         """
     230##         raise NotImplementedError
     231   
     232
    160233import function_field_element   
    161234       
    162235class FunctionFieldOrder_rational(PrincipalIdealDomain, FunctionFieldOrder):
     
    176249        """
    177250        FunctionFieldOrder.__init__(self, function_field)
    178251        IntegralDomain.__init__(self, self, names = function_field.variable_names(), normalize = False)
    179         self._ring = function_field.polynomial_ring()
     252        self._ring = function_field._ring
    180253        self._populate_coercion_lists_(coerce_list=[self._ring])
    181254        self._gen = self(self._ring.gen())
     255        self._basis = (self(1),)
     256
     257    def basis(self):
     258        """
     259        Return basis (=1) for this order as a module over the polynomial ring.
    182260       
     261        EXAMPLES::
     262
     263            sage: K.<t> = FunctionField(GF(19))
     264            sage: M = K.maximal_order()
     265            sage: M.basis()
     266            (1,)
     267            sage: parent(M.basis()[0])
     268            Maximal order in Rational function field in t over Finite Field of size 19
     269        """
     270        return self._basis
     271       
     272    def ideal(self, *gens):
     273        """
     274        Return the fractional ideal generated by the element gens or
     275        the elements in gens if gens is a list.
     276
     277        EXAMPLES::
     278
     279            sage: R.<y> = FunctionField(QQ)
     280            sage: S = R.maximal_order()
     281            sage: S.ideal(y)
     282            Ideal (y) of Maximal order in Rational function field in y over Rational Field
     283
     284        A fractional ideal of a nontrivial extension::
     285
     286            sage: R.<x> = FunctionField(GF(7)); S.<y> = R[]
     287            sage: L.<y> = R.extension(y^2 - x^3 - 1)
     288            sage: M = L.equation_order()
     289            sage: M.ideal(1/y)
     290            Ideal (1, (6/(x^3 + 1))*y) of Order in Function field in y defined by y^2 + 6*x^3 + 6
     291
     292        A non-principal ideal::
     293
     294            sage: R.<x> = FunctionField(GF(7))
     295            sage: S = R.maximal_order()
     296            sage: S.ideal(x^3+1,x^3+6)
     297            Ideal (1) of Maximal order in Rational function field in x over Finite Field of size 7
     298            sage: S.ideal((x^2+1)*(x^3+1),(x^3+6)*(x^2+1))
     299            Ideal (x^2 + 1) of Maximal order in Rational function field in x over Finite Field of size 7   
     300        """
     301        if len(gens) == 1:
     302            gens = gens[0]
     303            if not isinstance(gens, (list, tuple)):
     304                if is_Ideal(gens):
     305                    gens = gens.gens()
     306                else:
     307                    gens = [gens]
     308        from function_field_ideal import ideal_with_gens
     309        return ideal_with_gens(self, gens)
     310
    183311    def _repr_(self):
    184312        """
    185313        EXAMPLES::
     
    217345        EXAMPLES::
    218346
    219347            sage: R.<y> = FunctionField(QQ)
    220             sage: R.maximal_order()._element_constructor_(R.polynomial_ring().0)
     348            sage: R.maximal_order()._element_constructor_(y)
    221349            y
    222350        """
     351        # HUGE TODO: have to check that f is really in self!!
     352       
    223353        if f.parent() is self.fraction_field():
    224354            f = f.element()
    225         elif f.parent() is self._ring:
     355        if f.parent() is self._ring:
    226356            return function_field_element.FunctionFieldElement_rational(self, f)
    227357        return function_field_element.FunctionFieldElement_rational(self, self._ring(f))
    228            
     358
     359##     def polynomial_quotient_ring(self):
     360##         """
     361##         Return a quotient of a (possibly multivariate) polynomial ring
     362##         that is isomorphic to self, along with morphisms back and
     363##         forth.
     364
     365##         EXAMPLES::
     366##         """
     367##         return self._ring
     368
    229369   
    230    
    231    
     370       
     371       
  • sage/rings/function_field/todo.txt

    diff -r 11bc1c46e91c -r 10779925917f sage/rings/function_field/todo.txt
    a b  
    11TODO:
    22
     3[x] factor for elements of the rational function field
     4
    35[ ] ideals
     6[ ] isomorphisms between function fields:
     7     K.hom([top gen, next one down, etc.])
     8
     9[ ] Hess's algorithm
    410[ ] reduction algorithm
     11[ ] factoring polynomials in n variables over rational function field
     12
     13[ ] new implementation of the function field API using Singular; for *speed*, but with less base rings supported...?
    514
    615[ ] polynomial factoring of any univariate poly over a non-rational function field
    716