2022年12月31日 星期六

Python 量子運算(一二):括量與包量

Python 量子運算(一二):括量與包量

2022/12/31

-----


Fig. 12.1. Bra and ket.

-----

代碼 12.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
# Program 12.1:Bra and ket
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'$\langle\Psi\vert=\begin{bmatrix}a_1^*\quad a_2^*\end{bmatrix}$'
s1_2 = r'$\vert\Psi\rangle=\begin{bmatrix}a_1\\a_2\end{bmatrix}$'
s2 = r'$(1+i)^*=1-i$'
s3 = r'$\rm \langle bra\vert ket\rangle$'

# string output
ax.text(0.05, 0.75, s1_1)  # string 1
ax.text(0.60, 0.75, s1_2)
ax.text(0.05, 0.55, s2)    # string 2
ax.text(0.20, 0.15, s3, fontsize=160)  # string 3
ax.set_axis_off()

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

解說

-----

References


[1] Sabine Hossenfelder: Backreaction: Understanding Quantum Mechanics #4: It’s not as difficult as you think! (The Bra-Ket)

http://backreaction.blogspot.com/2020/07/understanding-quantum-mechanics-4-its.html


[2] LaTex中输入空格以及换行_橘子甜不甜的博客-CSDN博客_latex空格

https://blog.csdn.net/luolang_103/article/details/81289529


[3] 如何用latex編寫矩陣(包括各類複雜、大型矩陣)? - 知乎

https://zhuanlan.zhihu.com/p/266267223


[4] 5. 空間與位置

https://www.cs.pu.edu.tw/~wckuo/doc/latex123/node6.html

-----

Python 量子運算(目錄)

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

-----

沒有留言:

張貼留言

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