What is the matrix representation of a function of an quantum operator? If we know the matrix representation of a quantum operator, say $J$, will the matrix representation of any function of the operator i.e$f(J)$, same as acting the function on the matrix of the operator?
 A: Formally/heuristically, for sufficiently nice operator
$$\begin{align}\hat{A}~=~&\sum_{i,j\in I}|i\rangle A^i{}_j \langle j|\cr
~=~&\begin{bmatrix}|1\rangle & |2\rangle & \cdots \end{bmatrix} \stackrel{=}{A}\begin{bmatrix}\langle 1| \cr \langle 2| \cr \vdots \end{bmatrix}:~~{\cal H}\to{\cal H},\end{align}\tag{1}$$
function $f:\mathbb{C}\to\mathbb{C}$,
orthonormal basis $(|i\rangle)_{i\in I}$, (possibly infinite-dimensional) matrix
$$\stackrel{=}{A}
~=~\begin{bmatrix} A^1{}_1 & A^1{}_2 & \cdots \cr A^2{}_1 & A^2{}_2 & \cr
\vdots &&\ddots 
\end{bmatrix}\tag{2}$$
of matrix elements
$$ A^i{}_j~=~\langle i|\hat{A}|j\rangle, \tag{3}$$
then we may write
$$ f(\hat{A})~=~\begin{bmatrix}|1\rangle & |2\rangle & \cdots \end{bmatrix} f(\stackrel{=}{A})
\begin{bmatrix}\langle 1| \cr \langle 2| \cr \vdots \end{bmatrix},\tag{4}$$
if we formally Taylor-expand $f$ and use the orthonormality conditions
$$\begin{bmatrix}\langle 1| \cr \langle 2| \cr \vdots \end{bmatrix} \begin{bmatrix}|1\rangle & |2\rangle & \cdots \end{bmatrix}~=~\begin{bmatrix} 1 & 0 & \cdots \cr 0 & 1 & \cr
\vdots &&\ddots 
\end{bmatrix}~=~\stackrel{=}{\bf 1}.\tag{5}$$
Of course, there exist many reasons why OP's sought-for eq. (4) could fail when exposed to mathematical rigor. However eq. (4) does hold e.g. in finite dimensions when $f$ is an entire function.
A: It's not clear what you mean by "the function acting on the matrix of the operator."
If you mean
$$f\left(\begin{pmatrix}a & b\\ c & d\end{pmatrix}\right) = \begin{pmatrix}f(a) & f(b) \\ f(c) & f(d)\end{pmatrix}$$
then the answer is no, that is not what it usually means in physics.
The typical meaning is this: if a function has a power-series expansion $f(x) = \sum_n c_n x^n$ then you can define its operation on a matrix as $f(J) = \sum_n c_n J^n$ the power of $J$ are obtained from repeated matrix multiplication. Whether this is really well-defined for every matrix depends on the function.
If you are only interested in matrices that are diagonalizable like $J = PDP^{-1}$ then you can also define $f(J) = P\begin{pmatrix}f(d_1)&&\\&f(d_2)&\\& & \ddots\end{pmatrix}P^{-1}$. As long as $f(d)$ is defined for each of the diagonal entries this is well-defined and has the same result as the previous definition.
