@@ -680,58 +680,6 @@ def _groebner_strategy(self):
680
680
681
681
return GroebnerStrategy (MPolynomialIdeal (self .ring (), self .groebner_basis ()))
682
682
683
- def plot (self , singular = None ):
684
- r"""
685
- If you somehow manage to install surf, perhaps you can use
686
- this function to implicitly plot the real zero locus of this
687
- ideal (if principal).
688
-
689
- INPUT:
690
-
691
- - ``self`` -- must be a principal ideal in 2 or 3 vars over `\QQ`
692
-
693
- EXAMPLES:
694
-
695
- Implicit plotting in 2-d::
696
-
697
- sage: R.<x,y> = PolynomialRing(QQ,2)
698
- sage: I = R.ideal([y^3 - x^2])
699
- sage: I.plot() # cusp
700
- Graphics object consisting of 1 graphics primitive
701
- sage: I = R.ideal([y^2 - x^2 - 1])
702
- sage: I.plot() # hyperbola
703
- Graphics object consisting of 1 graphics primitive
704
- sage: I = R.ideal([y^2 + x^2*(1/4) - 1])
705
- sage: I.plot() # ellipse
706
- Graphics object consisting of 1 graphics primitive
707
- sage: I = R.ideal([y^2-(x^2-1)*(x-2)])
708
- sage: I.plot() # elliptic curve
709
- Graphics object consisting of 1 graphics primitive
710
-
711
- Implicit plotting in 3-d::
712
-
713
- sage: R.<x,y,z> = PolynomialRing(QQ,3)
714
- sage: I = R.ideal([y^2 + x^2*(1/4) - z])
715
- sage: I.plot() # a cone; optional - surf
716
- sage: I = R.ideal([y^2 + z^2*(1/4) - x])
717
- sage: I.plot() # same code, from a different angle; optional - surf
718
- sage: I = R.ideal([x^2*y^2+x^2*z^2+y^2*z^2-16*x*y*z])
719
- sage: I.plot() # Steiner surface; optional - surf
720
-
721
- AUTHORS:
722
-
723
- - David Joyner (2006-02-12)
724
- """
725
- if self .ring ().characteristic () != 0 :
726
- raise TypeError ("base ring must have characteristic 0" )
727
- if not self .is_principal ():
728
- raise TypeError ("self must be principal" )
729
- if singular is None :
730
- singular = singular_default
731
- singular .lib ('surf' )
732
- I = singular (self )
733
- I .plot ()
734
-
735
683
@require_field
736
684
@cached_method
737
685
@libsingular_gb_standard_options
@@ -5195,9 +5143,6 @@ def plot(self, *args, **kwds):
5195
5143
5196
5144
- ``self`` -- a principal ideal in 2 variables
5197
5145
5198
- - ``algorithm`` -- set this to 'surf' if you want 'surf' to
5199
- plot the ideal (default: ``None``)
5200
-
5201
5146
- ``*args`` -- (optional) tuples ``(variable, minimum, maximum)``
5202
5147
for plotting dimensions
5203
5148
@@ -5210,45 +5155,45 @@ def plot(self, *args, **kwds):
5210
5155
5211
5156
sage: R.<x,y> = PolynomialRing(QQ, 2)
5212
5157
sage: I = R.ideal([y^3 - x^2])
5213
- sage: I.plot() # cusp # needs sage.plot
5158
+ sage: I.plot() # cusp, needs sage.plot
5214
5159
Graphics object consisting of 1 graphics primitive
5215
5160
5216
5161
::
5217
5162
5218
5163
sage: I = R.ideal([y^2 - x^2 - 1])
5219
- sage: I.plot((x,-3, 3), (y, -2, 2)) # hyperbola # needs sage.plot
5164
+ sage: I.plot((x,-3, 3), (y, -2, 2)) # hyperbola, needs sage.plot
5220
5165
Graphics object consisting of 1 graphics primitive
5221
5166
5222
5167
::
5223
5168
5224
5169
sage: I = R.ideal([y^2 + x^2*(1/4) - 1])
5225
- sage: I.plot() # ellipse # needs sage.plot
5170
+ sage: I.plot() # ellipse, needs sage.plot
5226
5171
Graphics object consisting of 1 graphics primitive
5227
5172
5228
5173
::
5229
5174
5230
5175
sage: I = R.ideal([y^2-(x^2-1)*(x-2)])
5231
- sage: I.plot() # elliptic curve # needs sage.plot
5176
+ sage: I.plot() # elliptic curve, needs sage.plot
5232
5177
Graphics object consisting of 1 graphics primitive
5233
5178
5234
5179
::
5235
5180
5236
5181
sage: f = ((x+3)^3 + 2*(x+3)^2 - y^2)*(x^3 - y^2)*((x-3)^3-2*(x-3)^2-y^2)
5237
5182
sage: I = R.ideal(f)
5238
- sage: I.plot() # the Singular logo # needs sage.plot
5183
+ sage: I.plot() # the Singular logo, needs sage.plot
5239
5184
Graphics object consisting of 1 graphics primitive
5240
5185
5241
5186
::
5242
5187
5243
5188
sage: R.<x,y> = PolynomialRing(QQ, 2)
5244
5189
sage: I = R.ideal([x - 1])
5245
- sage: I.plot((y, -2, 2)) # vertical line # needs sage.plot
5190
+ sage: I.plot((y, -2, 2)) # vertical line, needs sage.plot
5246
5191
Graphics object consisting of 1 graphics primitive
5247
5192
5248
5193
::
5249
5194
5250
5195
sage: I = R.ideal([-x^2*y + 1])
5251
- sage: I.plot() # blow up # needs sage.plot
5196
+ sage: I.plot() # blow up, needs sage.plot
5252
5197
Graphics object consisting of 1 graphics primitive
5253
5198
"""
5254
5199
from sage .plot .all import implicit_plot
@@ -5264,50 +5209,45 @@ def plot(self, *args, **kwds):
5264
5209
f = self .gens ()[0 ]
5265
5210
5266
5211
variables = sorted (f .parent ().gens (), reverse = True )
5267
-
5268
- if len (variables ) == 2 and kwds .get ('algorithm' ,'' ) != 'surf' :
5269
- V = [(variables [0 ], None , None ), (variables [1 ], None , None )]
5270
-
5271
- if len (args ) > 2 :
5272
- raise TypeError ("Expected up to 2 optional parameters but got %d." % len (args ))
5273
-
5274
- # first check whether user supplied boundaries
5275
- for e in args :
5276
- if not isinstance (e , (tuple , list )) or len (e ) != 3 :
5277
- raise TypeError ("Optional parameter must be list or tuple or length 3." )
5278
- v ,mi ,ma = e
5279
-
5280
- if v not in variables :
5281
- raise TypeError ("Optional parameter must contain variable of ideal generator." )
5282
-
5283
- vi = variables .index (v )
5284
- V [vi ] = v ,mi ,ma
5285
-
5286
- # now check whether we should find boundaries
5287
- for var_index in range (2 ):
5288
- if V [var_index ][1 ] is None :
5289
- v , mi , ma = variables [var_index ], - 10 , 10
5290
- for i in range (mi , ma ):
5291
- poly = f .subs ({v :i }).univariate_polynomial ().change_ring (RR )
5292
- if not poly or len (poly .roots ()) > 0 :
5293
- mi = i - 1
5294
- break
5295
-
5296
- for i in range (ma , mi , - 1 ):
5297
- poly = f .subs ({v :i }).univariate_polynomial ().change_ring (RR )
5298
- if not poly or len (poly .roots ()) > 0 :
5299
- ma = i + 1
5300
- break
5301
- V [var_index ] = variables [var_index ], mi , ma
5302
-
5303
- kwds .setdefault ("plot_points" ,200 )
5304
- kwds .pop ('algorithm' , '' )
5305
- return implicit_plot (f , V [0 ], V [1 ], ** kwds )
5306
-
5307
- elif len (variables ) == 3 or kwds .get ('algorithm' ,'' ) == 'surf' :
5308
- MPolynomialIdeal_singular_repr .plot (self , kwds .get ("singular" ,singular_default ))
5309
- else :
5310
- raise TypeError ("Ideal generator may not have either 2 or 3 variables." )
5212
+ if len (variables ) != 2 :
5213
+ raise TypeError ("ideal generator does not have two variables" )
5214
+
5215
+ V = [(variables [0 ], None , None ), (variables [1 ], None , None )]
5216
+
5217
+ if len (args ) > 2 :
5218
+ raise TypeError ("Expected up to 2 optional parameters but got %d." % len (args ))
5219
+
5220
+ # first check whether user supplied boundaries
5221
+ for e in args :
5222
+ if not isinstance (e , (tuple , list )) or len (e ) != 3 :
5223
+ raise TypeError ("Optional parameter must be list or tuple or length 3." )
5224
+ v ,mi ,ma = e
5225
+
5226
+ if v not in variables :
5227
+ raise TypeError ("Optional parameter must contain variable of ideal generator." )
5228
+
5229
+ vi = variables .index (v )
5230
+ V [vi ] = v ,mi ,ma
5231
+
5232
+ # now check whether we should find boundaries
5233
+ for var_index in range (2 ):
5234
+ if V [var_index ][1 ] is None :
5235
+ v , mi , ma = variables [var_index ], - 10 , 10
5236
+ for i in range (mi , ma ):
5237
+ poly = f .subs ({v :i }).univariate_polynomial ().change_ring (RR )
5238
+ if not poly or len (poly .roots ()) > 0 :
5239
+ mi = i - 1
5240
+ break
5241
+
5242
+ for i in range (ma , mi , - 1 ):
5243
+ poly = f .subs ({v :i }).univariate_polynomial ().change_ring (RR )
5244
+ if not poly or len (poly .roots ()) > 0 :
5245
+ ma = i + 1
5246
+ break
5247
+ V [var_index ] = variables [var_index ], mi , ma
5248
+
5249
+ kwds .setdefault ("plot_points" ,200 )
5250
+ return implicit_plot (f , V [0 ], V [1 ], ** kwds )
5311
5251
5312
5252
def random_element (self , degree , compute_gb = False , * args , ** kwds ):
5313
5253
r"""
0 commit comments