title: In Mathematica, How calculate P(A) where P is a polynomial and A is a square matrix?
body: <p>supose i define a matrix like this:</p>
  
  <pre><code>A= {{1,1},{2,2}}
  </code></pre>
  
  <p>and now want to compute A^2 + 3A - 3Id, where a^2 is of course A.A</p>
  
  <p>The syntax in mathematica for doing this is:</p>
  
  <pre><code>MatrixPower[A,2] + 3A + 3 IdentityMatrix[2]
  </code></pre>
  
  <p>Is it posible to change de operators behavior in order to be able to write</p>
  
  <pre><code>A^2 + 3A - 3Id
  </code></pre>
  
  <p>and get the correct answer ?</p>
  
  <p>Or alternatively</p>
  
  <pre><code>applyPoly[x + 3x + 3, x, A]
  </code></pre>
  
  <p>or something like this ?</p>
  
  <p>I was tring some aproaches, but i couldn't do it.</p>
  
  <p>Thanks in advance...</p>