How to handle bra-ket in logarithm? $
\newcommand{\ket}[1]{\left| #1 \right>}
\newcommand{\bra}[1]{\left< #1 \right|}
$Say the following two equations:
$$ S = - k_B \text{Tr} (\rho \ln \rho) $$
$$ \rho = \sum _\epsilon \ket{\epsilon} \frac{\chi (\epsilon)}{w(E)} \bra{\epsilon} $$
where $\chi, w$ are some functions, and variables $\epsilon, E$ are independent. Now my textbook says
$$ S = - k_B \text{Tr} \left( \ket{\epsilon} \frac{\chi (\epsilon)}{w(E)} \ln \left( \frac{\chi (\epsilon)}{w(E)} \right) \bra{\epsilon} \right) $$
but I don't understand how to get this equation. Could anyone tell me the process?
My textbook: "Perspectives on Statistical Thermodynamics" (The second and the third equations are written in p.262 though the page can't be previewed on GoogleBooks.)
 A: Hint: Note that your density matrix $\rho$ is already diagonalized. So, $ \ln (\rho)$ is simply taking log of each diagonal element.
A: $
\newcommand{\ket}[1]{\left| #1 \right>}
\newcommand{\bra}[1]{\left< #1 \right|}
$For the future readers, I would like to prove the theorem

If $D$ is a diagonal matrix, $\ln (D)$ is simply taking log of each diagonal element $D_i$.

At first, logarithm of a matrix is defined as this, where $E$ is an identity matrix (which often denoted as $I$).
$$ \ln (A) \equiv \sum _{k=1} ^{\infty} \frac{1}{k} (-1)^{k-1} (A - E)^k $$
This definition is natural since this form is completely the same as the Taylor expansion of $\ln (x)$ around $x = 1$.
Now, let $D$ be a diagonal matrix. Then we can transcribe $D$ as
$$ D = \sum _i D_i \ket{i} \bra{i} $$
, where $\{D_i\}$ are the diagonal elements and $\{\ket{i}\}$ are the base ket vectors of diagonalization. This decomposition is not strange (if you don't understand, say the simplest case where $\ket{i} = {}^t(1\ \ 0)$ and you'll understand).
In addition, the next theorem is trivial. 
$$ D\ \text{is diagonal.}\ \ \Leftrightarrow\ \ D - E\ \text{is diagonal.}$$
Using these formulae, we can prove the theorem as below.
$$
\begin{eqnarray}
\ln (D) &=& \sum _{k=1} ^{\infty} \frac{1}{k} (-1)^{k-1} (D - E)^k \\
&=& \sum _{k=1} ^{\infty} \frac{1}{k} (-1)^{k-1} \left( \sum _i (D_i - E_i) \ket{i} \bra{i} \right)^k \\
&=& \sum _{k=1} ^{\infty} \frac{1}{k} (-1)^{k-1} \sum _i ((D_i - E_i) \ket{i} \bra{i})^k\ \ \ (\because \left< i | j \right> = \delta _{ij}) \\
&=& \sum _{k=1} ^{\infty} \frac{1}{k} (-1)^{k-1} \sum _i (D_i - E_i)^k \ket{i} \bra{i}\ \ \ (\because \ket{i} \bra{i} \ket{i} \bra{i} \cdots \ket{i} \bra{i} = \ket{i} \bra{i}) \\
&=& \sum _{k=1} ^{\infty} \frac{1}{k} (-1)^{k-1} \sum _i (D_i - 1)^k \ket{i} \bra{i} \\
&=& \sum _i \left( \sum _{k=1} ^{\infty} \frac{1}{k} (-1)^{k-1} (D_i - 1)^k \right) \ket{i} \bra{i} \\
&=& \sum _i \ln (D_i) \ket{i} \bra{i}
\end{eqnarray}
$$
This theorem instantly (and generally) solve my question.
