Entropy

From QETLAB
Revision as of 16:25, 15 October 2014 by Nathaniel (talk | contribs) (Created page with "{{Function |name=Entropy |desc=Computes the von Neumann entropy of a density matrix |cat=Information theory |upd=September 9, 2014 |v=...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Entropy
Computes the von Neumann entropy of a density matrix

Other toolboxes required none
Function category Information theory

Entropy is a function that computes the von Neumann entropy of a density matrix. That is, given a density matrix $\rho$, it computes the following quantity:

<math>S(\rho) := -\mathrm{Tr}\big(\rho\log_2(\rho)\big).</math>

Syntax

  • ENT = Entropy(RHO)
  • ENT = Entropy(RHO,BASE)

Argument descriptions

  • RHO: A density matrix to have its entropy computed.
  • BASE (optional, default 2): The base of the logarithm used in the entropy calculation.

Examples

The extreme cases: pure states and maximally-mixed states

A pure state has entropy zero:

>> Entropy(RandomDensityMatrix(4,0,1)) % entropy of a random 4-by-4 rank-1 density matrix

ans =

   7.3396e-15 % silly numerical errors: this is effectively zero

A d-by-d maximally-mixed state has entropy $\log_2(d)$:

>> Entropy(eye(4)/4)

ans =

     2

All other states have entropy somewhere between these two extremes:

>> Entropy(RandomDensityMatrix(4))

ans =

    1.6157

Source code

Click here to view this function's source code on github.