@@ -1031,6 +1031,15 @@ def complete_primary_decomposition(self, algorithm="sy"):
10311031 ...
10321032 ValueError: Coefficient ring must be a field for function 'complete_primary_decomposition'.
10331033
1034+ We try a simple example from page 51 of Atiyah-Macdonald::
1035+
1036+ sage: R.<x,y,z> = QQ[]
1037+ sage: I = R.ideal([x*y - z^2])
1038+ sage: A.<xbar,ybar,zbar> = R.quotient(I)
1039+ sage: p = A.ideal([x,z])
1040+ sage: p.primary_decomposition()
1041+ [Ideal (zbar, xbar) of Quotient of Multivariate Polynomial Ring in x, y, z over Rational Field by the ideal (x*y - z^2)]
1042+
10341043 ALGORITHM:
10351044
10361045 Uses Singular.
@@ -1063,15 +1072,22 @@ def complete_primary_decomposition(self, algorithm="sy"):
10631072 return []
10641073
10651074 import sage .libs .singular
1075+ R = self .ring ()
1076+ try :
1077+ if algorithm == 'sy' :
1078+ primdecSY = sage .libs .singular .ff .primdec__lib .primdecSY
1079+ P = primdecSY (self )
1080+ elif algorithm == 'gtz' :
1081+ primdecGTZ = sage .libs .singular .ff .primdec__lib .primdecGTZ
1082+ P = primdecGTZ (self )
1083+ except TypeError :
1084+ if algorithm == 'sy' :
1085+ P = self ._singular_ ().primdecSY ()
1086+ elif algorithm == 'gtz' :
1087+ P = self ._singular_ ().primdecGTZ ()
10661088
1067- if algorithm == 'sy' :
1068- primdecSY = sage .libs .singular .ff .primdec__lib .primdecSY
1069- P = primdecSY (self )
1070- elif algorithm == 'gtz' :
1071- primdecGTZ = sage .libs .singular .ff .primdec__lib .primdecGTZ
1072- P = primdecGTZ (self )
1089+ P = [([R (f ) for f in X [1 ]], [R (f ) for f in X [2 ]]) for X in P ]
10731090
1074- R = self .ring ()
10751091 V = [(R .ideal (X [0 ]), R .ideal (X [1 ])) for X in P ]
10761092 V = Sequence (V )
10771093 self .__complete_primary_decomposition [algorithm ] = V
0 commit comments