Entropy: Difference between revisions
Jump to navigation
Jump to search
Created page with "{{Function |name=Entropy |desc=Computes the von Neumann entropy of a density matrix |cat=Information theory |upd=September 9, 2014 |v=..." |
m Fix latex-isms |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{Function | {{Function | ||
|name=Entropy | |name=Entropy | ||
|desc=Computes the von Neumann entropy of a density matrix | |desc=Computes the von Neumann or Rényi entropy of a density matrix | ||
|cat=[[List of functions#Information_theory|Information theory]] | |cat=[[List of functions#Information_theory|Information theory]] | ||
|upd= | |upd=November 27, 2014}} | ||
<tt>'''Entropy'''</tt> is a [[List of functions|function]] that computes the von Neumann entropy or Rényi entropy of a density matrix. That is, given a density matrix $\rho$, it computes the following quantity: | |||
<tt>'''Entropy'''</tt> is a [[List of functions|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> | : <math>S(\rho) := -\mathrm{Tr}\big(\rho\log_2(\rho)\big)</math> | ||
(i.e., the von Neumann entropy) or the following quantity: | |||
: <math>S_\alpha(\rho) := \frac{1}{1-\alpha}\log_2\big(\mathrm{Tr}(\rho^\alpha)\big)</math> | |||
(i.e., the Rényi-<math>\alpha</math> entropy). | |||
==Syntax== | ==Syntax== | ||
* <tt>ENT = Entropy(RHO)</tt> | * <tt>ENT = Entropy(RHO)</tt> | ||
* <tt>ENT = Entropy(RHO,BASE)</tt> | * <tt>ENT = Entropy(RHO,BASE)</tt> | ||
* <tt>ENT = Entropy(RHO,BASE,ALPHA)</tt> | |||
==Argument descriptions== | ==Argument descriptions== | ||
* <tt>RHO</tt>: A density matrix to have its entropy computed. | * <tt>RHO</tt>: A density matrix to have its entropy computed. | ||
* <tt>BASE</tt> (optional, default 2): The base of the logarithm used in the entropy calculation. | * <tt>BASE</tt> (optional, default 2): The base of the logarithm used in the entropy calculation. | ||
* <tt>ALPHA</tt> (optional, default 1): A non-negative real parameter that determines which entropy is computed (<tt>ALPHA = 1</tt> corresponds to the von Neumann entropy, otherwise the Rényi-<tt>ALPHA</tt> entropy is computed). | |||
==Examples== | ==Examples== | ||
| Line 28: | Line 35: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
A d-by-d maximally-mixed state has entropy | A d-by-d maximally-mixed state has entropy <math>\log_2(d)</math>: | ||
<syntaxhighlight> | <syntaxhighlight> | ||
>> Entropy(eye(4)/4) | >> Entropy(eye(4)/4) | ||
| Line 45: | Line 52: | ||
1.6157 | 1.6157 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Notes== | |||
The Rényi-<math>\alpha</math> entropy approaches the von Neumann entropy as <math>\alpha \rightarrow 1</math>. | |||
{{SourceCode|name=Entropy}} | {{SourceCode|name=Entropy}} | ||
Latest revision as of 16:59, 4 August 2023
| Entropy | |
| Computes the von Neumann or Rényi entropy of a density matrix | |
| Other toolboxes required | none |
|---|---|
| Function category | Information theory |
Entropy is a function that computes the von Neumann entropy or Rényi 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>
(i.e., the von Neumann entropy) or the following quantity:
- <math>S_\alpha(\rho) := \frac{1}{1-\alpha}\log_2\big(\mathrm{Tr}(\rho^\alpha)\big)</math>
(i.e., the Rényi-<math>\alpha</math> entropy).
Syntax
- ENT = Entropy(RHO)
- ENT = Entropy(RHO,BASE)
- ENT = Entropy(RHO,BASE,ALPHA)
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.
- ALPHA (optional, default 1): A non-negative real parameter that determines which entropy is computed (ALPHA = 1 corresponds to the von Neumann entropy, otherwise the Rényi-ALPHA entropy is computed).
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 zeroA d-by-d maximally-mixed state has entropy <math>\log_2(d)</math>:
>> Entropy(eye(4)/4)
ans =
2All other states have entropy somewhere between these two extremes:
>> Entropy(RandomDensityMatrix(4))
ans =
1.6157Notes
The Rényi-<math>\alpha</math> entropy approaches the von Neumann entropy as <math>\alpha \rightarrow 1</math>.
Source code
Click here to view this function's source code on github.