id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
17922 coefficients() function more consistent between Expressions and polynomial rings JoalHeagney "The different behaviour between the two rings consists of
1. the `coefficients(sparse=True)` (which is default) method returns a list of pairs in `SR`, and a list in `PolynomialRing`,
2. `Expression.dict()` does not exist.
Example:
{{{
y = 3*x^3 + 2*x^2 - 4*x
print(y)
type(y)
}}}
Gives:
{{{
3*x^3 + 2*x^2 - 4*x
}}}
And
{{{
M = matrix(SR,[[1,2],[0,-2]])
ch = M.charpoly()
print(ch)
type(ch)
}}}
gives
{{{
x^2 + x - 2
}}}
But:
{{{
y.coeffs()
}}}
returns
{{{
[[−4,1],[2,2],[3,3]]
}}}
and
{{{
ch.coeffs()
}}}
returns
{{{
[−2,1,1]
}}}
I'd prefer if these two functions returned the same format, preferably the Expression format, as having access to the index allows list comprehension tastiness." enhancement new minor sage-6.6 algebra coeffs, rings, polynomials, expression, symbolic N/A