Ask Your Question

Revision history [back]

You can use the

sage: SR
Symbolic Ring

to convert the expression you get:

sage: m = random_matrix(ZZ, 3, 3)
sage: p = m.charpoly()
sage: type(p)
<type 'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint'>
sage: SR(p)
x^3 + 2*x^2 - 8*x + 5
sage: type(_)
<type 'sage.symbolic.expression.Expression'>

Make sure you really need the symbolic ring. In many cases, you can get what you want more efficiently without converting to symbolic ring.