【发布时间】:2021-05-31 06:56:15
【问题描述】:
我对 python 很陌生,我必须根据时间和位置对波函数进行动画处理。该公式是 sin 和 cos 函数的和,取决于 n 和 m 整数。在公式中还有 x,我想将其作为变量保留并进行求和,然后有一个仅取决于 x 的波函数。有可能吗? 下面是总结的部分:
import sympy as sp
import numpy as np
n = sp.Symbol('n', integer = True, positive = True)
m = sp.Symbol('m', integer = True, positive = True)
x = sp.Symbol('x', real = True)
t = sp.Symbol('t', real = True, positive = True)
a = sp.Symbol('a', real = True, positive = True)
h = sp.Symbol('hbar', real = True, positive = True)
mass = sp.Symbol('m', real = True, positive = True)
V0 = sp.Symbol('V')
C = 4 * mass * a**2 * V0 / sp.pi**3 / h**2
summ = sp.sin(m * sp.pi * x / a)/(n**2 - m**2)**2 * (n * sp.sin(sp.pi * m / 2) * sp.cos(sp.pi * n / 2) + m * sp.sin(sp.pi * n / 2) * sp.cos(sp.pi * m / 2))
Psi0 = lambdify((x, n, m), (summ).subs({h: 6.6 * 10**(-16), a: 1, mass: 9.1 * 10**(-31), V0: 10}))
Psi1 = 0
for i in range (0, 1000):
for j in range (0, 1000):
if i != j:
Psi1 += C * Psi0 (x, i, j)
【问题讨论】: