The Log Normal Distribution is often used to model the price dynamics of assets, particularly in financial applications such as option pricing. To model the log-normal distribution on a quantum computer, we need to “load” the distribution onto a quantum state. This means encoding the probabilities of different outcomes of the asset price into quantum amplitudes.
There is already an implementation of quantum state preparation of the log-normal distribution using 1 qubit, 2 qubits, and 3 qubits [1].
The goal of this project is to extend the existing implementation to prepare a quantum state using 4 qubits. And also, write a generalized algorithm that can be used to prepare a quantum state using any number of qubits.
To produce the mentioned distribution using a single qubit in a quantum circuit, we use RY gates, where RY gates correspond to the following matrix:
where 𝜃 is set to:
The resulting state will be:
The corresponding quantum circuit is:
After calculating the qunatum state, we obtain:
The probability distribution will be:
To prepare the distribution using two qubits, we must split the coefficient P0
of |0>
and assign the split values too |00>
and |01>
with the ratio P00:P01
. Then we split the coefficient P1
of |1>
and assign those values to |10>
and |11>
with the ratio P10:P11
. We can achieve this state using two additional RY gates with the two angles:
The corresponding quantum circuit is:
After calculating the qunatum state, we obtain:
The probability distribution will be:
We can use the same logic to prepare a quantum state with three qubits. The new required rotation angles will be:
The resulting circuit will be:
The probability distribution will be:
For the four-qubit representation, we were able to identify a pattern of the order of the application of RY gates, and created an algorithm that produces the quantum circuit for any given number of qubits. The new angles for the RY gates will be:
The corresponding quantum circuit will be:
And we will eventually get the fowllowing distribution:
Using the approach described in this report to prepare a quantum state that represents a log normal distribution might be very resource consuming. And, as we increase the number of qubits, the number of gates also increases exponentially. The following graph show the increase of the number of gates in function of the number of qubits used:
In order to run the project, you should follow the following steps:
# clone the project locally
git clone https://github.com/waterflow80/qunatum-computing-log-normal-distribition.git
# locate in the root directory
cd qunatum-computing-log-normal-distribition
# create a python virtual environment
python3.8 -m venv venv
. venv/bin/activate
# install dependencies
venv/bin/pip install -t requirements.txt
# run the notebook using vscode or spyder (in order to visualize the plots)
code .
# set the virtualenv in vscode to be venv
# execute the cell
To change the number of qubits, set the N_QUBITS = X
in the top of the script to your desired X.