Ticket #9054: trac_9054-can_this_really_be_the_last.patch

File trac_9054-can_this_really_be_the_last.patch, 2.9 KB (added by mderickx, 6 years ago)
  • sage/rings/function_field/function_field_order.py

    # HG changeset patch
    # User Maarten Derickx <m.derickx.student@gmail.com>
    # Date 1320712272 28800
    # Node ID ea60614cb5d0a712cdaac4e2a5b1a65fba50db7a
    # Parent  f14a46a3f3d5e30ad14eb2d5d87754edd67e5ec6
    #9054 last fixes
    
    diff --git a/sage/rings/function_field/function_field_order.py b/sage/rings/function_field/function_field_order.py
    a b  
    4242#*****************************************************************************
    4343
    4444from sage.rings.ring import IntegralDomain, PrincipalIdealDomain
     45from sage.rings.ideal import is_Ideal
    4546
    4647class FunctionFieldOrder(IntegralDomain):
    4748    """
     
    174175
    175176        INPUT:
    176177
    177             - ``gens`` -- a list of generators
     178            - ``gens`` -- a list of generators or an ideal in a ring which
     179                          coerces to this order.
    178180
    179181        EXAMPLES::
    180182
     
    188190        A fractional ideal of a nontrivial extension::
    189191
    190192            sage: K.<x> = FunctionField(GF(7)); R.<y> = K[]
     193            sage: O = K.maximal_order()
     194            sage: I = O.ideal(x^2-4)
    191195            sage: L.<y> = K.extension(y^2 - x^3 - 1)
    192             sage: O = L.equation_order()
    193             sage: O.ideal(1/y)
     196            sage: S = L.equation_order()
     197            sage: S.ideal(1/y)
    194198            Ideal (1, (6/(x^3 + 1))*y) of Order in Function field in y defined by y^2 + 6*x^3 + 6       
     199            sage: I2 = S.ideal(x^2-4); I2
     200            Ideal (x^2 + 3, (x^2 + 3)*y) of Order in Function field in y defined by y^2 + 6*x^3 + 6
     201            sage: I2 == S.ideal(I)
     202            True
    195203        """
    196204        if len(gens) == 1:
    197205            gens = gens[0]
    198206            if not isinstance(gens, (list, tuple)):
    199                 gens = [gens]
     207                if is_Ideal(gens):
     208                    gens = gens.gens()
     209                else:
     210                    gens = [gens]
    200211        from function_field_ideal import ideal_with_gens
    201212        return ideal_with_gens(self, gens)
    202213
     
    403414            True
    404415            sage: O.ideal(x^3+1,x^3+6)
    405416            Ideal (1) of Maximal order in Rational function field in x over Rational Field
    406             sage: O.ideal((x^2+1)*(x^3+1),(x^3+6)*(x^2+1))
     417            sage: I = O.ideal((x^2+1)*(x^3+1),(x^3+6)*(x^2+1)); I
     418            Ideal (x^2 + 1) of Maximal order in Rational function field in x over Rational Field
     419            sage: O.ideal(I)
    407420            Ideal (x^2 + 1) of Maximal order in Rational function field in x over Rational Field
    408421        """
    409422        if len(gens) == 1:
    410423            gens = gens[0]
    411424            if not isinstance(gens, (list, tuple)):
    412                 gens = (gens,)
     425                if is_Ideal(gens):
     426                    gens = gens.gens()
     427                else:
     428                    gens = (gens,)
    413429        from function_field_ideal import ideal_with_gens
    414430        return ideal_with_gens(self, gens)
    415431