Changeset 5190:daab147382bc
- Timestamp:
- 06/25/07 14:54:34 (6 years ago)
- 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. - Files:
-
- 2 edited
-
sage/rings/polynomial/multi_polynomial_ideal.py (modified) (3 diffs)
-
sage/rings/polynomial/multi_polynomial_ideal.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/rings/polynomial/multi_polynomial_ideal.py
r5182 r5190 127 127 from sage.misc.misc import prod 128 128 import sage.rings.integer_ring 129 129 import sage.rings.polynomial.toy_buchberger as toy_buchberger 130 130 131 131 def is_MPolynomialIdeal(x): … … 954 954 * 'singular:stdfglm' - Singular's stdfglm command 955 955 * '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 956 958 * 'macaulay2:gb' (if available) - Macaulay2's gb command 957 959 * 'magma:GroebnerBasis' (if available) - MAGMA's Groebnerbasis command 958 960 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. 960 1027 961 1028 """ … … 971 1038 elif algorithm == 'magma:GroebnerBasis': 972 1039 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) 973 1044 else: 974 1045 raise TypeError, "algorithm '%s' unknown"%algorithm -
sage/rings/polynomial/multi_polynomial_ideal.py
r5189 r5190 1 1 """ 2 2 Ideals in multivariate polynomial rings. 3 4 Most functionality of multivariate polynomial ideals in SAGE is 5 provided through SINGULAR. 3 6 4 7 AUTHOR: … … 6 9 -- Kiran S. Kedlaya (2006-02-12): added Macaulay2 analogues of 7 10 some Singular features 8 -- Martin Albrecht (2006-08-28): reorganized class hierarchy11 -- Martin Albrecht 9 12 10 13 EXAMPLES: … … 122 125 from sage.structure.sequence import Sequence 123 126 from sage.misc.sage_eval import sage_eval 127 from sage.misc.misc import prod 124 128 import sage.rings.integer_ring 125 129 import sage.rings.polynomial.toy_buchberger as toy_buchberger … … 224 228 def _contains_(self, f): 225 229 """ 230 Returns True if f is in the ideal self. 231 226 232 EXAMPLES: 227 233 sage: R, (x,y) = PolynomialRing(QQ, 2, 'xy').objgens() … … 233 239 sage: x^3 + 2*y in I 234 240 True 241 242 NOTE: Requires computation of a Groebner basis, which is a 243 very expensive operation. 235 244 """ 236 245 … … 353 362 """ 354 363 The dimension of the ring modulo this ideal. 364 365 NOTE: Requires computation of a Groebner basis, which is a 366 very expensive operation. 355 367 """ 356 368 try: … … 592 604 sage: (y^2 - x)^2 593 605 y^4 - 2*x*y^2 + x^2 606 607 NOTE: Requires computation of a Groebner basis, which is a 608 very expensive operation. 594 609 """ 595 610 if self.base_ring() == sage.rings.integer_ring.ZZ: … … 769 784 else: 770 785 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) ) ] ) 772 816 773 817 class MPolynomialIdeal_macaulay2_repr:
Note: See TracChangeset
for help on using the changeset viewer.
