2022年12月18日 星期日

Python 量子運算(九):半角

Python 量子運算(九):半角

2022/12/05

-----


Fig. 9.1. Half angle.

-----

代碼 9.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
27
28
29
# Program 9.1:Half angle
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'$\vert\psi\rangle$'
s1_2 = r'$=\cos\frac{\theta}{2}\ \vert0\rangle'\
       r'+e^{i\phi}\sin\frac{\theta}{2}\ \vert1\rangle$'

s2 = r'$=\begin{bmatrix}\cos\frac{\theta}{2}\\'\
     r'\ e^{i\phi}\sin\frac{\theta}{2}\ \end{bmatrix}$'

s3 = r'$(0\leq\theta\leq\pi,\ 0\leq\phi<2\pi)$'

# string output
ax.text(0.10, 0.75, s1_1)
ax.text(0.25, 0.75, s1_2)
ax.text(0.25, 0.45, s2)
ax.text(0.10, 0.15, s3)
ax.set_axis_off()

# plt.savefig('/content/drive/My Drive/pqc/0009_001.png')
plt.show()

解說:


-----

References


[1] 布洛赫球面 - 維基百科,自由的百科全書

https://zh.m.wikipedia.org/zh-tw/%E5%B8%83%E6%B4%9B%E8%B5%AB%E7%90%83%E9%9D%A2


[2] Quantum States And The Bloch Sphere | Quantum Untangled

https://medium.com/quantum-untangled/quantum-states-and-the-bloch-sphere-9f3c0c445ea3


[3] Introduction to quantum computing: Bloch sphere. — Anastasios Kyrillidis

http://akyrillidis.github.io/notes/quant_post_7

-----

Python 量子運算(目錄)

https://mandhistory.blogspot.com/2022/01/quantum-computing.html

-----

沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。