2024-04-05 13:22:08 -04:00
|
|
|
import numpy as np
|
|
|
|
import pylab as pl
|
|
|
|
|
|
|
|
a = 5
|
2024-04-08 11:45:54 -04:00
|
|
|
F = 4000
|
2024-04-05 13:22:08 -04:00
|
|
|
D = 1
|
|
|
|
hbar = 1
|
|
|
|
m = 1
|
2024-04-08 11:45:54 -04:00
|
|
|
z = 2.851
|
2024-04-05 13:22:08 -04:00
|
|
|
l = z / a
|
|
|
|
V0 = 2
|
|
|
|
|
2024-04-08 11:45:54 -04:00
|
|
|
|
|
|
|
def cot(x):
|
|
|
|
return 1 / np.tan(x)
|
|
|
|
|
|
|
|
|
2024-04-05 13:22:08 -04:00
|
|
|
x = np.linspace(-10, 10, 1000)
|
|
|
|
x_pos = x[x > 0]
|
|
|
|
z0 = (a / hbar) * np.sqrt(2 * m * V0)
|
|
|
|
print(f'z0 = {z0}')
|
2024-04-08 11:45:54 -04:00
|
|
|
k = -l * cot(l * a)
|
2024-04-05 13:22:08 -04:00
|
|
|
|
|
|
|
psi_conditions = [
|
|
|
|
(0 < x_pos) & (x_pos <= a),
|
|
|
|
(x_pos > a)
|
|
|
|
]
|
|
|
|
psi_funcs = [
|
2024-04-08 11:45:54 -04:00
|
|
|
lambda x: D * np.sin(l * x),
|
2024-04-05 13:22:08 -04:00
|
|
|
lambda x: F * np.exp(-k * x),
|
|
|
|
]
|
|
|
|
psi_half = np.piecewise(x_pos, psi_conditions, psi_funcs)
|
2024-04-08 11:45:54 -04:00
|
|
|
psi = np.concatenate((-np.flip(psi_half), psi_half))
|
2024-04-05 13:22:08 -04:00
|
|
|
|
|
|
|
V0_graph = np.piecewise(x, [(x < -a), (-a <= x) & (x <= a), (x > a)], [0, -V0, 0])
|
|
|
|
|
|
|
|
pl.plot(x, psi)
|
|
|
|
pl.plot(x, V0_graph)
|
|
|
|
pl.show()
|