Python Entanglement Entropy
In this blog post, we will teach our users how to use the Python entropy function of the Qiskit library. We will not only tell the use of this function but also help them to know its real meaning. This problem is also known as python entanglement entropy.
Python Entanglement Entropy
The Shannon entropy defines how much information is added to our knowledge by knowing the average value of a random variable. The degree of uncertainty we have about X before discovering the outcome value is indicated by the entropy of X. As well to compute this Shannon entropy one should follow certain steps in the python programming language. The equivalent code is as follows:
import numpy as np from qiskit import * import math as m from scipy import linalg as la %matplotlib inline
Here we import numpy and math for basic computations. Next library qiskit which is the library that contains the function for entropy. The optimized ATLAS LAPACK and BLAS libraries are useful in building SciPy. It can perform linear algebra quite quickly. Here we use matplotlib for the plotting of different graphs. The code for computing the values goes as:
HY = -m.log2(1/6) print(HY)
The output of the above code is as follows:
The above code is the basic code for the computation of entropy.
Also Read: What is a support vector machine and its Working
Pingback: np.random.choice() in NumPy Python - Study Experts