用Qutip绘制布洛赫球
文章目录
- 布洛赫球的物理意义
- Qutip绘图
布洛赫球的物理意义
布洛赫球(Bloch sphere)是量子计算中用来直观表示单量子比特(qubit)状态的几何模型。
再量子计算中,qubit的任意纯态可表示为两个基态的线性叠加
∣ ψ ⟩ = α ∣ 0 ⟩ + β ∣ 1 ⟩ |\psi\rangle=\alpha|0\rangle+\beta|1\rangle∣ψ⟩=α∣0⟩+β∣1⟩
其中α , β \alpha,\betaα,β均为复数,且满足归一化条件
$$
\alpha2+\beta2=1\to\begin{aligned}
\alpha=\cos\frac{\theta}{2}e^{i\gamma_\alpha}\
\beta=\sin\frac{\theta}{2}e^{i\gamma_\beta}\
\end{aligned}
$$
由于量子态∣ ψ ⟩ |\psi\rangle∣ψ⟩和e i γ ∣ ψ ⟩ e^{i\gamma}|\psi\rangleeiγ∣ψ⟩代表同一物理态,所以用相位差来表示α , β \alpha,\betaα,β,从而量子态可表示为
∣ ψ ⟩ = cos θ 2 ∣ 0 ⟩ + e i ϕ sin θ 2 ∣ 1 ⟩ |\psi\rangle=\cos\frac{\theta}{2}|0\rangle+e^{i\phi}\sin\frac\theta 2|1\rangle∣ψ⟩=cos2θ∣0⟩+eiϕsin2θ∣1⟩
式中θ \thetaθ为极角,ϕ \phiϕ为方位角,二者刚好能构成一个三维的单位球,如下图所示。
在Bloch球中,球面上的每一个点都代表量子比特的一个纯态,其中
- 北极代表∣ 0 ⟩ |0\rangle∣0⟩
- 南极代表∣ 1 ⟩ |1\rangle∣1⟩
- 赤道上θ = π 2 \theta=\frac{\pi}{2}θ=2π,代表∣ 0 ⟩ |0\rangle∣0⟩和∣ 1 ⟩ |1\rangle∣1⟩的等概率叠加,具体来说
- ϕ = 0 \phi=0ϕ=0代表∣ + ⟩ = ∣ 0 ⟩ + ∣ 1 ⟩ 2 |+\rangle=\frac{|0\rangle+|1\rangle}{\sqrt2}∣+⟩=2∣0⟩+∣1⟩
- ϕ = π \phi=\piϕ=π代表∣ − ⟩ = ∣ 0 ⟩ − ∣ 1 ⟩ 2 |-\rangle=\frac{|0\rangle-|1\rangle}{\sqrt2}∣−⟩=2∣0⟩−∣1⟩
- ϕ = π 2 \phi=\frac{\pi}{}2ϕ=π2代表∣ + i ⟩ = ∣ 0 ⟩ + i ∣ 1 ⟩ 2 |+i\rangle=\frac{|0\rangle+i|1\rangle}{\sqrt2}∣+i⟩=2∣0⟩+i∣1⟩
- ϕ = 3 π 2 \phi=\frac{3\pi}{2}ϕ=23π代表∣ − i ⟩ = ∣ 0 ⟩ − i ∣ 1 ⟩ 2 |-i\rangle=\frac{|0\rangle-i|1\rangle}{\sqrt2}∣−i⟩=2∣0⟩−i∣1⟩
Qutip绘图
Qutip中提供了便捷的Bloch球绘图函数,想要得到上面的Bloch球,代码如下
importqutip b=qutip.Bloch()b.render()importmatplotlib.pyplotasplt plt.show()【Bloch】即Bloch球的类,【render】用于渲染绘图。
布洛赫球上可以用向量或点表示不同的量子态,示例如下
代码为
b=qutip.Bloch()x=(qutip.basis(2,0)+(1+0j)*qutip.basis(2,1)).unit()y=(qutip.basis(2,0)+(0+1j)*qutip.basis(2,1)).unit()z=(qutip.basis(2,0)+(0+0j)*qutip.basis(2,1)).unit()b.add_states([x,y,z])th=np.linspace(0,2*np.pi,20)xp,yp,zp=np.cos(th),np.sin(th),np.zeros(20)b.add_points([xp,yp,zp])b.render()