Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.

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.

sage: M=ModularSymbols(23,2,1) sage: T2=M.T(2).matrix() sage: var ('x') x sage: I=identity_matrix(3) sage: f=(x*I-T2).det() sage: f ((x + 1)*x - 1)*(x - 3) sage: F=f.factor_list() sage: F [(x^2 + x - 1, 1), (x - 3, 1)] sage: K=F[0][0]^F[1][1] sage: K(x=2) 5 sage: K.parent() Symbolic Ring sage: R.<x> = PolynomialRing(QQ, 'x') sage: s=R(K) sage: s.parent() Univariate Polynomial Ring in x over Rational Field sage: s(T2) [11 -2 -3] [ 0 0 0] [ 0 0 0]

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.

sage: M=ModularSymbols(23,2,1) sage: T2=M.T(2).matrix() sage: var ('x') x sage: I=identity_matrix(3) sage: f=(x*I-T2).det() sage: f ((x + 1)*x - 1)*(x - 3) sage: F=f.factor_list() sage: F [(x^2 + x - 1, 1), (x - 3, 1)] sage: K=F[0][0]^F[1][1] sage: K(x=2) 5 sage: K.parent() Symbolic Ring sage: R.<x> = PolynomialRing(QQ, 'x') sage: s=R(K) sage: s.parent() Univariate Polynomial Ring in x over Rational Field sage: s(T2) [11 -2 -3] [ 0 0 0] [ 0 0 0]

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.

sage: M=ModularSymbols(23,2,1)
sage: T2=M.T(2).matrix()
sage: var ('x')
x
sage: I=identity_matrix(3)
sage: f=(x*I-T2).det()
sage: f
((x + 1)*x - 1)*(x - 3)

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.

sage: M=ModularSymbols(23,2,1)
sage: T2=M.T(2).matrix()
sage: var ('x')
x
sage: I=identity_matrix(3)
sage: f=(x*I-T2).det()
sage: f
((x + 1)*x - 1)*(x - 3)