# Homework Help: How can I do when I make a Log2 towards zero?

Tags:
1. Aug 1, 2016

### munirah

Good day,

1. The problem statement, all variables and given/known data

I want to make a measurement on qubit by using formula von Neumann entropy using Mathematica given as below;

2. Relevant equations

(ρ)=−Tr(ρlog2ρ)

3. The attempt at a solution

The
ρ={{0.5,0},{0,0.5}}

My problem is, when I make the

log2{{0.5,0},{0,0.5}}
I get the output

{{−1,∞},{∞,−1}}

How can I deal with this value in my measurement since it cannot be calculated?

Thank you.

2. Aug 1, 2016

### Staff: Mentor

Looks like you take the logarithm of each entry in the matrix. I don't think that is what you want.
Matrix log?

3. Aug 1, 2016

### BvU

Can you put in some lower limit, like $2^{-20}$ ?
 Ha !

[edit2] Isn't it so that you have already diagonalized $\rho$ so you can use the $S = - \sum \eta\ln\eta$ here ?

Last edited: Aug 1, 2016
4. Aug 1, 2016

### munirah

I'm not sure about the matrix log.I think it different

5. Aug 1, 2016

### munirah

thank you for the input. I will search it and learn

6. Aug 1, 2016

### BvU

My guess is the matrix log coincides with taking log of the diagonal elements once the matrix is diagonalized ...

7. Aug 1, 2016

### munirah

it means only for diagonal matrices?

8. Aug 1, 2016

### BvU

Just a guess.

9. Aug 1, 2016

### munirah

ok. thank you very much. i will look about it.

10. Aug 1, 2016

### Staff: Mentor

Sure. This should be easy to see if you take the matrix exponential again.