Evaluating a polynomial on a matrices
Hi, I would like to evaluate a polynomial f(x) with coefficients as integers by letting x to be a matrix T. How do I do this on sage? The context is this: I have a matrix A. sage can tell me the characteristic polynomial of A. It will even factorize it for me, say, as f_1(x)f_2(x)f_3(x). I know how to extract each irreducible factor. Is there a way that I can use f_i(x) to evaluate it on a matrix, using sage? (other than manually writing out the polynomial with x replaced by the matrix I wish to evaluate on)
I am new to sage so apologies if this is a silly question.