# qml.vn_entropy¶

vn_entropy(wires, log_base=None)[source]

Von Neumann entropy of the system prior to measurement.

$S( \rho ) = -\text{Tr}( \rho \log ( \rho ))$
Parameters
• wires (Sequence[int] or int) – The wires of the subsystem

• log_base (float) – Base for the logarithm. If None, the natural logarithm is used.

Example:

dev = qml.device("default.qubit", wires=2)

@qml.qnode(dev)
def circuit_entropy(x):
qml.IsingXX(x, wires=[0, 1])
return qml.vn_entropy(wires=[0])


Executing this QNode:

>>> circuit_entropy(np.pi/2)
0.6931472


It is also possible to get the gradient of the previous QNode:

>>> param = np.array(np.pi/4, requires_grad=True)

Calculating the derivative of vn_entropy() is currently supported when using the classical backpropagation differentiation method (diff_method="backprop") with a compatible device and finite differences (diff_method="finite-diff").