Home | Algorithms | Commercialization | Data Science | Information Theories | Quantum Theories | Lab | Linear Algebra |
<< Bloch Sphere Orthonormality | Eigenstate of Multi-Qubits >> |
$\require{cancel} \newcommand{\Ket}[1]{\left|{#1}\right\rangle} \newcommand{\Bra}[1]{\left\langle{#1}\right|} \newcommand{\Braket}[1]{\left\langle{#1}\right\rangle} \newcommand{\Rsr}[1]{\frac{1}{\sqrt{#1}}} \newcommand{\RSR}[1]{1/\sqrt{#1}} \newcommand{\Verti}{\rvert} \newcommand{\HAT}[1]{\hat{\,#1~}} \DeclareMathOperator{\Tr}{Tr}$
First created in July 2018
The Bloch Vector is composed of the expectation values of $\Ket\psi$ on the three Pauli axes: $\{\Braket{X}_\psi,\Braket{Y}_\psi,\Braket{Z}_\psi\}.$
The Kous Delta Operator $~B_\psi=\Braket{X}_\psi X+\Braket{Y}_\psi Y+\Braket{Z}_\psi Z~$ rotates a state vector by $\pi$ about $\Ket\psi$. (Note: $B_\psi^2=I.$)
The (pure) state of $\Ket\psi$ in density matrix form is $\rho =\Ket\psi\Bra\psi ={1\over2}\big(I+B_\psi\big) ={1\over2}\big(I+\Braket{X}_\psi X+\Braket{Y}_\psi Y+\Braket{Z}_\psi Z\big) .$
In other words, $\rho$ is the average of $I$ and $B_\psi$.
Given an arbitrary state $\Ket\phi,~ B_\psi\Ket\phi=\Braket{X}_\psi X\Ket\phi+\Braket{Y}_\psi Y\Ket\phi+\Braket{Z}_\psi Z\Ket\phi.$
A density matrix is also a projector, so $\rho\Ket\phi$ can be interpreted as rotating $\Ket\phi$ by $\pi$ about $\Ket\psi$ by applying the Bloch Operator then taking an "average" on $\Ket\phi$ itself (the identity matrix), hence the sum divided by two.
Note: $R_\psi(\theta) =e^{-i\frac{\theta}{2}B_\psi} =I\cos\frac{\theta}{2}-iB_\psi\sin\frac{\theta}{2} .~~$ For details, please refer to the Rotation: Matrix Exponential articles.
Let $\Ket\psi=\alpha\Ket0+\beta\Ket1,~~\alpha,\beta\in\mathbb{C}.~~$ So $\rho=\Ket\psi\Bra\psi =\begin{bmatrix}\alpha\alpha^*&\alpha\beta^*\\\alpha^*\beta&\beta\beta^*\end{bmatrix},~~$ and $\Braket{\psi\Verti\psi}=\alpha\alpha^*+\beta\beta^*=1$.
$\Braket{X}_\psi =\Braket{\psi\lvert X\rvert\psi} =(\alpha^*\Bra0+\beta^*\Bra1)~(\Ket0\Bra1+\Ket1\Bra0)~(\alpha\Ket0+\beta\Ket1) =\alpha^*\beta+\alpha\beta^* .$
$\Braket{Y}_\psi =\Braket{\psi\lvert Y\rvert\psi} =(\alpha^*\Bra0+\beta^*\Bra1)~(-i\Ket0\Bra1+i\Ket1\Bra0)~(\alpha\Ket0+\beta\Ket1) =-i\alpha^*\beta+i\alpha\beta^* .$
$\Braket{Z}_\psi =\Braket{\psi\lvert Z\rvert\psi} =(\alpha^*\Bra0+\beta^*\Bra1)~(\Ket0\Bra0-\Ket1\Bra1)~(\alpha\Ket0+\beta\Ket1) =\alpha^*\alpha-\beta^*\beta .$
$I+\Braket{X}_\psi X+\Braket{Y}_\psi Y+\Braket{Z}_\psi Z$
$=\begin{bmatrix}(\alpha\alpha^*+\beta\beta^*)&0\\0&(\alpha\alpha^*+\beta\beta^*)\end{bmatrix} +\begin{bmatrix}0&(\alpha^*\beta+\alpha\beta^*)\\(\alpha^*\beta+\alpha\beta^*)&0\end{bmatrix} +\begin{bmatrix}0&-i(-i\alpha^*\beta+i\alpha\beta^*)\\i(-i\alpha^*\beta+i\alpha\beta^*)&0\end{bmatrix} +\begin{bmatrix}(\alpha\alpha^*-\beta\beta^*)&0\\0&-(\alpha\alpha^*-\beta\beta^*)\end{bmatrix}$
$=\begin{bmatrix} (\alpha\alpha^*+\beta\beta^*)+(\alpha\alpha^*-\beta\beta^*) & (\alpha^*\beta+\alpha\beta^*)-i(-i\alpha^*\beta+i\alpha\beta^*)\\ (\alpha^*\beta+\alpha\beta^*)+i(-i\alpha^*\beta+i\alpha\beta^*) & (\alpha\alpha^*+\beta\beta^*)-(\alpha\alpha^*-\beta\beta^*) \end{bmatrix} =\begin{bmatrix}2\alpha\alpha^* & 2\alpha\beta^*\\ 2\alpha^*\beta & 2\beta\beta^* \end{bmatrix} =2\rho .$
# quantum_phase_bloch.py
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute
from qiskit.tools.visualization import plot_bloch_vector
# Define the Quantum and Classical Registers
q = QuantumRegister(1)
c = ClassicalRegister(1)
# Build the circuits
pre = QuantumCircuit(q, c)
pre.h(q)
pre.barrier()
meas_x = QuantumCircuit(q, c)
meas_x.barrier()
meas_x.h(q)
meas_x.measure(q, c)
meas_y = QuantumCircuit(q, c)
meas_y.barrier()
meas_y.s(q).inverse()
meas_y.h(q)
meas_y.measure(q, c)
meas_z = QuantumCircuit(q, c)
meas_z.barrier()
meas_z.measure(q, c)
bloch_vector = ['x', 'y', 'z']
exp_vector = range(0, 21)
circuits = []
for exp_index in exp_vector:
middle = QuantumCircuit(q, c)
phase = 2*np.pi*exp_index/(len(exp_vector)-1)
middle.u1(phase, q)
circuits.append(pre + middle + meas_x)
circuits.append(pre + middle + meas_y)
circuits.append(pre + middle + meas_z)
#print(len(circuits))
#print(exp_vector)
# Execute the circuit
job = execute(circuits, backend = 'local_qasm_simulator', shots=1024)
result = job.result()
# Plot the result
for exp_index in exp_vector:
bloch = [0, 0, 0]
for bloch_index in range(len(bloch_vector)):
data = result.get_counts(circuits[3*exp_index+bloch_index])
print(data)
try:
p0 = data['0']/1024.0
except KeyError:
p0 = 0
try:
p1 = data['1']/1024.0
except KeyError:
p1 = 0
bloch[bloch_index] = p0-p1
plot_bloch_vector(bloch)
<< Bloch Sphere Orthonormality | Top | Eigenstate of Multi-Qubits >> |