Skip to content

Commit 1bc29df

Browse files
committed
remove a_realization, adding content, other small tweaks to doc
1 parent a29e33a commit 1bc29df

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

src/sage/rings/polynomial/integer_valued_polynomials.py

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ class IntegerValuedPolynomialRing(UniqueRepresentation, Parent):
4343
`\binom{x}{n}` for `n \geq 0` (the *binomial basis*) and of
4444
the other sequence `\binom{x+n}{n}` for `n \geq 0` (the *shifted basis*).
4545
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+
4656
TESTS::
4757
4858
sage: IntegerValuedPolynomialRing(24)
@@ -64,21 +74,6 @@ def __init__(self, R):
6474

6575
_shorthands = ["B", "S"]
6676

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-
8277
def _repr_(self) -> str:
8378
r"""
8479
Return the string representation.
@@ -234,7 +229,7 @@ def shift(self, j=1):
234229
A = self.parent()
235230
return A._from_dict({i + j: c for i, c in self})
236231

237-
def sum(self):
232+
def sum_of_coefficients(self):
238233
"""
239234
Return the sum of coefficients.
240235
@@ -244,11 +239,27 @@ def sum(self):
244239
245240
sage: F = IntegerValuedPolynomialRing(ZZ).S()
246241
sage: B = F.basis()
247-
sage: (B[2]*B[4]).sum()
242+
sage: (B[2]*B[4]).sum_of_coefficients()
248243
1
249244
"""
250245
return sum(c for _, c in self)
251246

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+
252263
class Shifted(CombinatorialFreeModule, BindableClass):
253264
r"""
254265
The integer-valued polynomial ring in the shifted basis.

0 commit comments

Comments
 (0)