fft - 如何使用傅里叶变换计算动量矩阵元素?
问题描述
我正在尝试使用位置空间中特征函数的傅里叶变换来计算谐振子的基态和第一激发态之间的动量矩阵元素。我无法正确计算动量矩阵元素。
这是我的代码
hbar = 1
nPoints = 501
xmin = -5
xmax = 5
dx = (xmax - xmin) / nPoints
x = np.array([(i - nPoints // 2) * dx for i in range(nPoints)])
potential = np.array([0.5 * point**2 for point in x]) # harmonic potential
# get eigenstates, eigenvalues with Fourier grid Hamiltonian approach
energies, psis = getEigenstatesFGH(x, potential, mass=1, hbar=hbar)
# should be 0.5, 1.5, 2.5, 3.5, 4.5 or very close to that
for i in range(5):
print(f"{energies[i]:.2f}")
# identify the necessary wave functions
groundState = psis[:, 0]
firstExcitedState = psis[:, 1]
# fourier transform the wave functions into k-space (momentum space)
dp = (2 * np.pi) / (np.max(x) - np.min(x))
p = np.array([(i - nPoints // 2) * dp for i in range(nPoints)])
groundStateK = (1 / np.sqrt(2 * np.pi * hbar)) * np.fft.fftshift(np.fft.fft(groundState))
firstExcitedStateK = (1 / np.sqrt(2 * np.pi * hbar)) * np.fft.fftshift(np.fft.fft(firstExcitedState))
# calculate matrix elements
xMatrix = np.eye(nPoints) * x
pMatrix = np.eye(nPoints) * p
# <psi0 | x-hat | psi1 >, this works correctly
x01 = np.dot(np.conjugate(groundState), np.dot(xMatrix, firstExcitedState))
# <~psi0 | p-hat | ~psi1 >, this gives wrong answer
p01 = np.dot(np.conjugate(groundStateK), np.dot(pMatrix, firstExcitedStateK))
解决方案
推荐阅读
- python - 调用函数并非所有函数都使用 argparse 快捷方式
- forms - Spring Boot - 使用@PathVariable 将数据放入更新表单
- python - 如何实现虚拟属性层次结构?
- authentication - 将逻辑应用凭据传递给自定义 SharePoint 客户端 C# 函数应用 SharePoint
- sql - 带有否定 WHERE 条件的 SQL JOIN
- ruby - 在 ActiveAdmin 中根据需要设置字段
- python - 删除 XML 标记外的字符
- bro - 是否可以使用 Zeek 检查 TCP 保留位?
- joomla - 如何从弹出窗口的菜单项中打开文章?
- sql - 两行的部分连接