There is a non-zero probability this has been hashed out before, but I
couldn't find it.  And it was brought to me by an experienced Sage
user, and the documentation is not much help either.

sage: t = polygen(QQ, 't')
sage: p = t^4 + 8
sage: p.parent()
Univariate Polynomial Ring in t over Rational Field
sage: p.coeffs()
[8, 0, 0, 0, 1]
sage: p.coefficients()
[8, 1]

The output of  coeffs()  is what I would expect from both of these.
And I cannot see the use of the latter output since I have no idea
where these coefficients come from (ie  t + 8 would yield identical
output).

Behavior is different for symbolic expressions, and makes more sense,
given the possibility of negative or non-integer exponents, and you
can track where the coefficients came from.

sage: z = var('z')
sage: q = z^4 + 8
sage: q.coefficients()
[[8, 0], [1, 4]]

Also, for symbolic expressions, coeffs is an alias:

sage: q.coeffs == q.coefficients
True

Any explanations or comments on the univariate polynomial case?  I'm
not trying to open the can-of-worms that is symbolic polynomials.

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to