首页 > 解决方案 > 如何使用傅里叶变换计算动量矩阵元素?

问题描述

我正在尝试使用位置空间中特征函数的傅里叶变换来计算谐振子的基态和第一激发态之间的动量矩阵元素。我无法正确计算动量矩阵元素。

这是我的代码

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))

标签: fft

解决方案


推荐阅读