File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1354,6 +1354,30 @@ def term_order(self):
1354
1354
"""
1355
1355
return self .__R .term_order ()
1356
1356
1357
+ def random_element (self ):
1358
+ r"""
1359
+ Return a random element of this quotient ring obtained by
1360
+ sampling a random element of the cover ring and reducing
1361
+ it modulo the defining ideal.
1362
+
1363
+ EXAMPLES::
1364
+
1365
+ sage: R.<x,y> = QQ[]
1366
+ sage: S = R.quotient([x^3, y^2])
1367
+ sage: S.random_element() # random
1368
+ -8/5*xbar^2 + 3/2*xbar*ybar + 2*xbar - 4/23
1369
+
1370
+ TESTS:
1371
+
1372
+ Make sure we are not just getting images of integers in this
1373
+ ring (which would be the case if the default implementation
1374
+ of this method was inherited from generic rings)::
1375
+
1376
+ sage: any(S.random_element() not in ZZ for _ in range(999))
1377
+ True
1378
+ """
1379
+ return self .retract (self .cover_ring ().random_element ())
1380
+
1357
1381
1358
1382
class QuotientRing_generic (QuotientRing_nc , ring .CommutativeRing ):
1359
1383
r"""
You can’t perform that action at this time.
0 commit comments