Skip to content

Commit 6fbb720

Browse files
committed
made documentation and test informative
1 parent 7a38e60 commit 6fbb720

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/sage/rings/polynomial/polynomial_element.pyx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5940,20 +5940,22 @@ cdef class Polynomial(CommutativePolynomial):
59405940
return a*self
59415941

59425942
def coefficients(self, sparse=True):
5943-
"""
5944-
Return the coefficients of the monomials appearing in self.
5943+
r"""
5944+
Return the coefficients of the monomials appearing in ``self``.
5945+
59455946
If ``sparse=True`` (the default), it returns only the non-zero coefficients.
59465947
Otherwise, it returns the same value as ``self.list()``.
59475948
(In this case, it may be slightly faster to invoke ``self.list()`` directly.)
5949+
In either case, the coefficients are ordered by increasing degree.
59485950
59495951
EXAMPLES::
59505952
59515953
sage: _.<x> = PolynomialRing(ZZ)
5952-
sage: f = x^4 + 2*x^2 + 1
5954+
sage: f = 3*x^4 + 2*x^2 + 1
59535955
sage: f.coefficients()
5954-
[1, 2, 1]
5956+
[1, 2, 3]
59555957
sage: f.coefficients(sparse=False)
5956-
[1, 0, 2, 0, 1]
5958+
[1, 0, 2, 0, 3]
59575959
"""
59585960
zero = self._parent.base_ring().zero()
59595961
if sparse:

0 commit comments

Comments
 (0)