Changeset 5190:daab147382bc


Ignore:
Timestamp:
06/25/07 14:54:34 (6 years ago)
Author:
'Martin Albrecht <malb@…
Branch:
default
Parents:
5188:a80ccb008dea (diff), 5189:df988cf43484 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sage/rings/polynomial/multi_polynomial_ideal.py

    r5182 r5190  
    127127from sage.misc.misc import prod 
    128128import sage.rings.integer_ring 
    129  
     129import sage.rings.polynomial.toy_buchberger as toy_buchberger 
    130130 
    131131def is_MPolynomialIdeal(x): 
     
    954954                         * 'singular:stdfglm' - Singular's stdfglm command 
    955955                         * 'singular:slimgb' - Singular's slimgb command 
     956                         * 'toy:buchberger' - SAGE's toy/educational buchberger without strategy 
     957                         * 'toy:buchberger2' - SAGE's toy/educational buchberger with strategy 
    956958                         * 'macaulay2:gb' (if available) - Macaulay2's gb command 
    957959                         * 'magma:GroebnerBasis' (if available) - MAGMA's Groebnerbasis command 
    958960 
    959         ALGORITHM: Uses Singular, MAGMA, or Macaulay2 (if available) 
     961        EXAMPLES: 
     962            Consider Katsura-3 over QQ with term ordering 'degrevlex' 
     963 
     964            sage: P.<a,b,c> = PolynomialRing(QQ,3, order='lex') 
     965            sage: I = sage.rings.ideal.Katsura(P,3) # regenerate to prevent caching 
     966            sage: I.groebner_basis() 
     967            [84*c^4 - 40*c^3 + c^2 + c, 7*b + 210*c^3 - 79*c^2 + 3*c, 7*a - 420*c^3 + 158*c^2 + 8*c - 7] 
     968 
     969 
     970            sage: I = sage.rings.ideal.Katsura(P,3) # regenerate to prevent caching 
     971            sage: I.groebner_basis('singular:groebner') 
     972            [84*c^4 - 40*c^3 + c^2 + c, 7*b + 210*c^3 - 79*c^2 + 3*c, 7*a - 420*c^3 + 158*c^2 + 8*c - 7] 
     973 
     974            sage: I = sage.rings.ideal.Katsura(P,3) # regenerate to prevent caching 
     975            sage: I.groebner_basis('singular:std') 
     976            [84*c^4 - 40*c^3 + c^2 + c, 7*b + 210*c^3 - 79*c^2 + 3*c, 7*a - 420*c^3 + 158*c^2 + 8*c - 7] 
     977 
     978            sage: I = sage.rings.ideal.Katsura(P,3) # regenerate to prevent caching 
     979            sage: I.groebner_basis('singular:stdhilb') 
     980            [84*c^4 - 40*c^3 + c^2 + c, 7*b + 210*c^3 - 79*c^2 + 3*c, 5*b^2 - b - 3*c^2 + c, a + 2*b + 2*c - 1] 
     981 
     982            sage: I = sage.rings.ideal.Katsura(P,3) # regenerate to prevent caching 
     983            sage: I.groebner_basis('singular:stdfglm') 
     984            [84*c^4 - 40*c^3 + c^2 + c, 7*b + 210*c^3 - 79*c^2 + 3*c, 7*a - 420*c^3 + 158*c^2 + 8*c - 7] 
     985 
     986            sage: I = sage.rings.ideal.Katsura(P,3) # regenerate to prevent caching 
     987            sage: I.groebner_basis('singular:slimgb') 
     988            [84*c^4 - 40*c^3 + c^2 + c, 7*b + 210*c^3 - 79*c^2 + 3*c, 7*a - 420*c^3 + 158*c^2 + 8*c - 7] 
     989 
     990            sage: I = sage.rings.ideal.Katsura(P,3) # regenerate to prevent caching 
     991            sage: I.groebner_basis('toy:buchberger') 
     992            [-30*c^4 + 100/7*c^3 - 5/14*c^2 - 5/14*c, -2*b^2 - b*c + 1/2*b, a + 2*b + 2*c - 1,  
     993             7/125*b + 42/25*c^3 - 79/125*c^2 + 3/125*c, a^2 - a + 2*b^2 + 2*c^2,  
     994             -5*b*c + 1/2*b - 6*c^2 + 2*c, 2*a*b + 2*b*c - b] 
     995 
     996            sage: I = sage.rings.ideal.Katsura(P,3) # regenerate to prevent caching 
     997            sage: I.groebner_basis('toy:buchberger2') 
     998            [30*c^4 - 100/7*c^3 + 5/14*c^2 + 5/14*c, a + 2*b + 2*c - 1,  
     999             7/125*b + 42/25*c^3 - 79/125*c^2 + 3/125*c, a^2 - a + 2*b^2 + 2*c^2] 
     1000 
     1001            sage: I = sage.rings.ideal.Katsura(P,3) # regenerate to prevent caching 
     1002            sage: I.groebner_basis('macaulay2:gb') # optional requires Macaulay2 
     1003            [84*c^4 - 40*c^3 + c^2 + c, 7*b + 210*c^3 - 79*c^2 + 3*c, 7*a - 420*c^3 + 158*c^2 + 8*c - 7] 
     1004             
     1005            sage: I = sage.rings.ideal.Katsura(P,3) # regenerate to prevent caching 
     1006            sage: I.groebner_basis('magma:GroebnerBasis') # optional requires MAGMA 
     1007            [a - 60*c^3 + 158/7*c^2 + 8/7*c - 1, b + 30*c^3 - 79/7*c^2 + 3/7*c, c^4 - 10/21*c^3 + 1/84*c^2 + 1/84*c] 
     1008 
     1009            If Macaulay2 is installed, Groebner bases over ZZ can be computed. 
     1010 
     1011            sage: P.<a,b,c> = PolynomialRing(ZZ,3) 
     1012            sage: I = P * (a + 2*b + 2*c - 1, a^2 - a + 2*b^2 + 2*c^2, 2*a*b + 2*b*c - b) 
     1013            sage: I.groebner_basis() #optional requires Macaulay2  
     1014            [a + 2*b + 2*c - 1, 10*b*c + 12*c^2 - b - 4*c, 2*b^2 - 4*b*c - 6*c^2 + 2*c,  
     1015             42*c^3 + b^2 + 2*b*c - 14*c^2 + b, 2*b*c^2 - 6*c^3 + b^2 + 5*b*c + 8*c^2 - b - 2*c, 
     1016             b^3 + b*c^2 + 12*c^3 + b^2 + b*c - 4*c^2] 
     1017 
     1018            SAGE also supports local orderings (via SINGULAR): 
     1019 
     1020            sage: P.<x,y,z> = PolynomialRing(QQ,3,order='negdegrevlex') 
     1021            sage: I = P * (  x*y*z + z^5, 2*x^2 + y^3 + z^7, 3*z^5 +y ^5 ) 
     1022            sage: I.groebner_basis() 
     1023            [2*x^2 + y^3, x*y*z + z^5, y^5 + 3*z^5, y^4*z - 2*x*z^5, z^6] 
     1024 
     1025        ALGORITHM: Uses Singular, MAGMA (if available), Macaulay2 (if 
     1026        available), or toy implementation. 
    9601027 
    9611028        """ 
     
    9711038        elif algorithm == 'magma:GroebnerBasis': 
    9721039            return self._magma_groebner_basis() 
     1040        elif algorithm == 'toy:buchberger': 
     1041            return toy_buchberger.buchberger(self) 
     1042        elif algorithm == 'toy:buchberger2': 
     1043            return toy_buchberger.buchberger_improved(self) 
    9731044        else: 
    9741045            raise TypeError, "algorithm '%s' unknown"%algorithm 
  • sage/rings/polynomial/multi_polynomial_ideal.py

    r5189 r5190  
    11""" 
    22Ideals in multivariate polynomial rings. 
     3 
     4Most functionality of multivariate polynomial ideals in SAGE is 
     5provided through SINGULAR. 
    36 
    47AUTHOR: 
     
    69    -- Kiran S. Kedlaya (2006-02-12): added Macaulay2 analogues of 
    710              some Singular features 
    8     -- Martin Albrecht (2006-08-28): reorganized class hierarchy 
     11    -- Martin Albrecht 
    912 
    1013EXAMPLES: 
     
    122125from sage.structure.sequence import Sequence 
    123126from sage.misc.sage_eval import sage_eval 
     127from sage.misc.misc import prod 
    124128import sage.rings.integer_ring 
    125129import sage.rings.polynomial.toy_buchberger as toy_buchberger 
     
    224228    def _contains_(self, f): 
    225229        """ 
     230        Returns True if f is in the ideal self. 
     231         
    226232        EXAMPLES: 
    227233            sage: R, (x,y) = PolynomialRing(QQ, 2, 'xy').objgens() 
     
    233239            sage: x^3 + 2*y in I 
    234240            True 
     241 
     242        NOTE: Requires computation of a Groebner basis, which is a 
     243        very expensive operation. 
    235244        """ 
    236245 
     
    353362        """ 
    354363        The dimension of the ring modulo this ideal. 
     364 
     365        NOTE: Requires computation of a Groebner basis, which is a 
     366        very expensive operation. 
    355367        """ 
    356368        try: 
     
    592604            sage: (y^2 - x)^2 
    593605            y^4 - 2*x*y^2 + x^2 
     606 
     607        NOTE: Requires computation of a Groebner basis, which is a 
     608        very expensive operation. 
    594609        """ 
    595610        if self.base_ring() == sage.rings.integer_ring.ZZ: 
     
    769784        else: 
    770785            raise TypeError, "Cannot convert basis with given algorithm" 
    771              
     786 
     787    def elimination_ideal(self, variables): 
     788        """ 
     789        Returns the elimination ideal of self with respect to the 
     790        variables given in 'variables'. 
     791 
     792        INPUT: 
     793            variables -- a list or tuple of variables in self.ring() 
     794 
     795        EXAMPLE: 
     796            sage: R.<x,y,t,s,z> = PolynomialRing(QQ,5) 
     797            sage: I = R * [x-t,y-t^2,z-t^3,s-x+y^3] 
     798            sage: I.elimination_ideal([t,s]) 
     799            Ideal (y^2 - x*z, x*y - z, x^2 - y) of Polynomial Ring in x, y, t, s, z over Rational Field 
     800 
     801        ALGORITHM: Uses SINGULAR 
     802 
     803        NOTE: Requires computation of a Groebner basis, which is a 
     804        very expensive operation. 
     805        """ 
     806        if not isinstance(variables, (list,tuple)): 
     807            variables = (variables,) 
     808         
     809        try: 
     810            Is = self.__singular_groebner_basis 
     811        except AttributeError: 
     812            Is = self._singular_() 
     813 
     814        R = self.ring() 
     815        return MPolynomialIdeal(R, [f.sage_poly(R) for f in Is.eliminate( prod(variables) ) ] ) 
    772816 
    773817class MPolynomialIdeal_macaulay2_repr: 
Note: See TracChangeset for help on using the changeset viewer.