I try to find out the Characteristic Polynomial and Eigen values using sympy
. But when I print the results in Jupyter notebook all the fractions in the coefficients of the polynomials have been evaluated as float
(e.g-0.5x**2+1)
but I want $(1/2)x^2+1$)
. Is there anything to solve this problem. Thank you.
My Code
import sympy as sp
from sympy import *
x, y, z = symbols('x,y,z')
init_printing(use_unicode=False, wrap_line=False)
M = sp.Matrix([[0, -1/2], [1/3, 0]])
x = symbols('x')
p = M.charpoly(x)
p
Output.