Open
Description
The different behaviour between the two rings consists of
- the
coefficients(sparse=True)
(which is default) method returns a list of pairs inSR
, and a list inPolynomialRing
, 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
<type 'sage.symbolic.expression.Expression'>
And
M = matrix(SR,[[1,2],[0,-2]])
ch = M.charpoly()
print(ch)
type(ch)
gives
x^2 + x - 2
<class 'sage.rings.polynomial.polynomial_element_generic.Polynomial_generic_dense_field'>
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.
Component: algebra
Keywords: coeffs, rings, polynomials, expression, symbolic
Issue created by migration from https://trac.sagemath.org/ticket/17922