File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
src/sage/rings/polynomial Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -5940,20 +5940,22 @@ cdef class Polynomial(CommutativePolynomial):
5940
5940
return a* self
5941
5941
5942
5942
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
+
5945
5946
If ``sparse=True`` ( the default) , it returns only the non-zero coefficients.
5946
5947
Otherwise, it returns the same value as ``self. list( ) ``.
5947
5948
( In this case, it may be slightly faster to invoke ``self. list( ) `` directly. )
5949
+ In either case, the coefficients are ordered by increasing degree.
5948
5950
5949
5951
EXAMPLES::
5950
5952
5951
5953
sage: _. <x> = PolynomialRing( ZZ)
5952
- sage: f = x^4 + 2*x^2 + 1
5954
+ sage: f = 3 * x^ 4 + 2* x^ 2 + 1
5953
5955
sage: f. coefficients( )
5954
- [1, 2, 1 ]
5956
+ [1, 2, 3 ]
5955
5957
sage: f. coefficients( sparse=False)
5956
- [1, 0, 2, 0, 1 ]
5958
+ [1, 0, 2, 0, 3 ]
5957
5959
"""
5958
5960
zero = self ._parent.base_ring().zero()
5959
5961
if sparse:
You can’t perform that action at this time.
0 commit comments