Python 量子運算(八):球面上的線性組合
2022/11/26
-----
Fig. 8.1. Qubit psi.
-----
代碼 8.1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Program 8.1:Qubit psi import matplotlib as mpl import matplotlib.pyplot as plt # figure setting mpl.rcParams['text.usetex'] = True mpl.rcParams['text.latex.preamble'] = r'\usepackage{{amsmath}}' mpl.rcParams['font.size'] = 80 fig, ax = plt.subplots(figsize=(16, 16)) # string setting s1_1 = r'$\vert0\rangle\equiv\begin{bmatrix}1\\0\end{bmatrix},$' s1_2 = r'$\vert1\rangle\equiv\begin{bmatrix}0\\1\end{bmatrix},$' s2 = r'$\vert\psi\rangle=\alpha\vert0\rangle+\beta\vert1\rangle'\ r'\equiv\begin{bmatrix}\alpha\\\beta\end{bmatrix},$' s3 = r'$\vert\alpha\vert^2+\vert\beta\vert^2=1$.' # string output ax.text(0.10, 0.75, s1_1) # equation 1 ax.text(0.50, 0.75, s1_2) ax.text(0.10, 0.45, s2) # equation 2 ax.text(0.10, 0.15, s3) # equation 3 ax.set_axis_off() # plt.savefig('/content/drive/My Drive/pqc/0008_001.png') plt.show() |
解說:
-----
Python 量子運算(目錄)
https://mandhistory.blogspot.com/2022/01/quantum-computing.html
-----
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。