Skip to content

Commit de22175

Browse files
author
Matthias Koeppe
committed
MPolynomialRing_base.some_elements: New
1 parent fa2b06a commit de22175

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/sage/rings/polynomial/multi_polynomial_ring_base.pyx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,27 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
12991299

13001300
return self(dict(zip(M, C)))
13011301

1302+
def some_elements(self):
1303+
r"""
1304+
Return a list of polynomials.
1305+
1306+
This is typically used for running generic tests.
1307+
1308+
EXAMPLES::
1309+
1310+
sage: R.<x,y> = QQ[]
1311+
sage: R.some_elements()
1312+
[x, y, x + y, x^2 + x*y, 0, 1]
1313+
1314+
"""
1315+
R = self.base_ring()
1316+
L = list(self.gens())
1317+
if L:
1318+
L.append(L[0] + L[-1])
1319+
L.append(L[0] * L[-1])
1320+
L.extend([self.zero(), self.one()])
1321+
return L
1322+
13021323
def change_ring(self, base_ring=None, names=None, order=None):
13031324
"""
13041325
Return a new multivariate polynomial ring which isomorphic to

0 commit comments

Comments
 (0)