Question: Analytic Functions and matrices

I am trying to find a easy way to use analytic functions with matrices. For example A:= 2x2 matrix (that is diagonalizable) then cos (A) = P L P^1 where P is the matrix made of the eigen vectors and L is the matrix of eigen values along the main diagonal. While I can work these problems by figuring the parts (P L P^1) I would prefer to find a way to be able to just write cos(A). I figure there is a syntax that I am failing to use properly to use this function with a matrix input. Any help would be appreciated.
Please Wait...