This repository was archived by the owner on Jan 30, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-13
lines changed
src/sage/rings/polynomial Expand file tree Collapse file tree 1 file changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -1347,30 +1347,25 @@ def lt(self):
1347
1347
1348
1348
def __eq__ (self ,right ):
1349
1349
"""
1350
+ EXAMPLES::
1350
1351
1352
+ sage: x = PolynomialRing(RealField(42), 'x', 2).gens()
1353
+ sage: x[0]^2 - x[1]^2 == SR(0)
1354
+ x0^2 - x1^2 == 0
1351
1355
"""
1352
1356
if not isinstance (right ,MPolynomial_polydict ):
1353
- # we want comparison with zero to be fast
1354
- if right == 0 :
1355
- if self ._MPolynomial_element__element .dict ()== {}:
1356
- return True
1357
- else :
1358
- return False
1359
1357
return self ._richcmp_ (right ,2 )
1360
1358
return self ._MPolynomial_element__element == right ._MPolynomial_element__element
1361
1359
1362
1360
def __ne__ (self ,right ):
1363
1361
"""
1362
+ EXAMPLES::
1364
1363
1364
+ sage: x = PolynomialRing(RealField(42), 'x', 2).gens()
1365
+ sage: x[0]^2 - x[1]^2 != SR(0)
1366
+ x0^2 - x1^2 != 0
1365
1367
"""
1366
1368
if not isinstance (right ,MPolynomial_polydict ):
1367
- # we want comparison with zero to be fast
1368
- if right == 0 :
1369
- if self ._MPolynomial_element__element .dict ()== {}:
1370
- return False
1371
- else :
1372
- return True
1373
- # maybe add constant elements as well
1374
1369
return self ._richcmp_ (right ,3 )
1375
1370
return self ._MPolynomial_element__element != right ._MPolynomial_element__element
1376
1371
You can’t perform that action at this time.
0 commit comments