Ask Your Question

Revision history [back]

Factorize characteristic polynomial in SR base ring

I am total newbie to SAGE so this question might be trivial. How can I factorize the characteristic polynomial obtained by a symbolic matrix in SAGE 8.6? Is there a workaround the fact that factor() is not defined on the base ring SR which is the one inherited from the symbolic matrix?

For example I have in a SAGE/Jupyter notebook something like:

a,b,c = var('a','b','c')
M = Matrix(SR,3,3)
M[0] = [a, -b, 0]
M[1] = [c, a+b, 0]
M[2] = [0, 0, 1]
e = M.eigenvalues()
f = M.charpoly()

The last instruction raises a NotImplementedError as expected from the fact that factor is not defined on SR... In my real problem I am computing characteristic polynomials of large (8x8) symbolic matrices and I would like to get at glance all the factors, so as to quickly isolate negative real roots and instead easily discuss conditions for existence and sign of symbolic ones.