@@ -43,6 +43,16 @@ class IntegerValuedPolynomialRing(UniqueRepresentation, Parent):
43
43
`\binom{x}{n}` for `n \geq 0` (the *binomial basis*) and of
44
44
the other sequence `\binom{x+n}{n}` for `n \geq 0` (the *shifted basis*).
45
45
46
+ These two bases are available as follows::
47
+
48
+ sage: B = IntegerValuedPolynomialRing(QQ).Binomial()
49
+ sage: S = IntegerValuedPolynomialRing(QQ).Shifted()
50
+
51
+ or by using the shortcuts::
52
+
53
+ sage: B = IntegerValuedPolynomialRing(QQ).B()
54
+ sage: S = IntegerValuedPolynomialRing(QQ).S()
55
+
46
56
TESTS::
47
57
48
58
sage: IntegerValuedPolynomialRing(24)
@@ -64,21 +74,6 @@ def __init__(self, R):
64
74
65
75
_shorthands = ["B" , "S" ]
66
76
67
- def a_realization (self ):
68
- r"""
69
- Return the default realization of ``self``.
70
-
71
- This is the shifted basis.
72
-
73
- EXAMPLES::
74
-
75
- sage: A = IntegerValuedPolynomialRing(QQ)
76
- sage: A.a_realization()
77
- Integer-Valued Polynomial Ring over Rational Field
78
- in the shifted basis
79
- """
80
- return self .S ()
81
-
82
77
def _repr_ (self ) -> str :
83
78
r"""
84
79
Return the string representation.
@@ -234,7 +229,7 @@ def shift(self, j=1):
234
229
A = self .parent ()
235
230
return A ._from_dict ({i + j : c for i , c in self })
236
231
237
- def sum (self ):
232
+ def sum_of_coefficients (self ):
238
233
"""
239
234
Return the sum of coefficients.
240
235
@@ -244,11 +239,27 @@ def sum(self):
244
239
245
240
sage: F = IntegerValuedPolynomialRing(ZZ).S()
246
241
sage: B = F.basis()
247
- sage: (B[2]*B[4]).sum ()
242
+ sage: (B[2]*B[4]).sum_of_coefficients ()
248
243
1
249
244
"""
250
245
return sum (c for _ , c in self )
251
246
247
+ def content (self ):
248
+ """
249
+ Return the content of ``self``.
250
+
251
+ This is the gcd of the coefficients.
252
+
253
+ EXAMPLES::
254
+
255
+ sage: F = IntegerValuedPolynomialRing(ZZ).S()
256
+ sage: B = F.basis()
257
+ sage: (3*B[4]+6*B[7]).content()
258
+ 3
259
+ """
260
+ from sage .arith .misc import gcd
261
+ return gcd (c for _ , c in self )
262
+
252
263
class Shifted (CombinatorialFreeModule , BindableClass ):
253
264
r"""
254
265
The integer-valued polynomial ring in the shifted basis.
0 commit comments