# Revision history [back]

### How to define a polynomial which can take matrix ?

I want to define a matrix valued function. for example..

If I have a polynomial of a matrix with me say $f(x)$ and I want to check $f(A)$. What can be done better? The following will work for numbers but not for matrix.

var('x') f(x)=2x^2+x+3 print f(A)# this is what I want as an answer..

**

## In the above if I want to replace my x by a matrix what I have to do?

**

So, ultimate aim is to find define a polynomial which can take matrix Thanks in advance...

 2 No.2 Revision tmonteil 23518 ●25 ●170 ●431 http://wiki.sagemath.o...

### How to define a polynomial which can take matrix ?

I want to define a matrix valued function. for example..

If I have a polynomial of a matrix with me say $f(x)$ and I want to check $f(A)$. What can be done better? The following will work for numbers but not for matrix.

var('x')
f(x)=2x^2+x+3
print f(A)# this is what I want as an answer.. 
answer.. 

**

## In the above if I want to replace my x by a matrix what I have to do?

**

So, ultimate aim is to find define a polynomial which can take matrix Thanks in advance...