-
Notifications
You must be signed in to change notification settings - Fork 1
/
quantum-tunneling8.py
129 lines (92 loc) · 3.19 KB
/
quantum-tunneling8.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import matplotlib.pyplot as plt
import numpy as np
from math import *
a = int(input("render level "))
b = int(input("render level animation = "))
l = float(input("lenght = "))*(10**(-10))
q = l/2.07
r = float(input("size of potential barrer = "))*(10**(-10))
n = int(input("n = "))
h = 6.62607015*(10**(-34))
h_bar = h/(2*np.pi)
m = 9.1093837015*(10**(-31))
E = ((n**2)*(h**2))/(8*m*l**2)
print("the total energy of the particle is ", E)
V_o = float(input("V_o = "))*(1.6*(10**(-19)))
alpha = (np.sqrt(2*m*(V_o-E)))/h_bar
print("alpha ", alpha)
tmax = int(input("tmax = "))*(10**(-15))
xA = np.linspace(0, q, a)
xB = np.linspace(q, (q+r), a)
xC = np.linspace((q+r), l, a)
t = np.linspace(0, tmax, int(b*(tmax*(10**(15)))))
def delta(x):
s = (np.exp(-alpha*x))/(2*(np.sin(((n*np.pi)/l)*x)))
return(s)
B = np.sqrt(1/((2*((delta(q))**2)*(q - (l/(2*n*np.pi))*np.sin(((2*n*np.pi)/l)*q))) - (1/(2*alpha))*((np.exp(-alpha*(q+r)))-(np.exp(-alpha*q))) + (2*((delta(q+r))**2)*(l - q + r + (l/(2*n*np.pi))*np.sin(((2*n*np.pi)/l)*(q+r))))))
A = 2*B*delta(q)
C = 2*B*delta(q+r)
yBoundaries = np.linspace(-(A + A/100), (A + A/100), 10)
I = B**2*(((2*((delta(q))**2)*(q - (l/(2*n*np.pi))*np.sin(((2*n*np.pi)/l)*q))) - (1/(2*alpha))*((np.exp(-alpha*(q+r)))-(np.exp(-alpha*q))) + (2*((delta(q+r))**2)*(l - q + r + (l/(2*n*np.pi))*np.sin(((2*n*np.pi)/l)*(q+r))))))
print("total integral = ", I)
I_ = (B**2*(2*((delta(q+r))**2)*(l - q + r + (l/(2*n*np.pi))*np.sin(((2*n*np.pi)/l)*(q+r)))))*100
print("probability of the particle to be behind the potential barrer = ", I_, "%")
def AP(x):
s = (A*np.sin(((n*np.pi)/l)*x))**2
return(s)
def BP(x):
s = B**2*(np.exp((-2*alpha*x)))
return(s)
def CP(x):
s = (C*np.sin(((n*np.pi)/l)*x))**2
return(s)
plt.plot(xA, AP(xA), color = 'red', label = "density probablity")
plt.plot(xB, BP(xB), color = 'green', label = "density probability in the potential barrer")
plt.plot(xC, CP(xC), color = 'red')
plt.legend()
plt.show()
def AR(x, t):
s = np.cos(-(E/h_bar)*t) * (A*np.sin(((n*np.pi)/l)*x))
return(s)
def AC(x, t):
s = np.sin(-(E/h_bar)*t) * (A*np.sin(((n*np.pi)/l)*x))
return(s)
def BR(x, t):
s = np.cos(-(E/h_bar)*t) * (B*(np.exp((-alpha*x))))
return(s)
def BC(x, t):
s = np.sin(-(E/h_bar)*t) * (B*(np.exp((-alpha*x))))
return(s)
def CR(x, t):
s = np.cos(-(E/h_bar)*t) * (C*np.sin(((n*np.pi)/l)*x))
return(s)
def CC(x, t):
s = np.sin(-(E/h_bar)*t) * (C*np.sin(((n*np.pi)/l)*x))
return(s)
plt.figure()
plt.ion()
plt.plot([], [])
i = 0
while i<b:
ar = AR(xA, t[i])
ac = AC(xA, t[i])
br = BR(xB, t[i])
bc = BC(xB, t[i])
cr = CR(xC, t[i])
cc = CC(xC, t[i])
borderL = np.linspace(q, q, 10)
borderR = np.linspace((q+r), (q+r), 10)
plt.clf()
plt.title(t[i])
plt.plot(xA, ar, color = 'blue')
plt.plot(xA, ac, color = 'green')
plt.plot(xB, br, color = 'red')
plt.plot(xB, bc, color = 'red')
plt.plot(xC, cr, color = 'blue')
plt.plot(xC, cc, color = 'green')
plt.plot(borderL, yBoundaries, color = 'red')
plt.plot(borderR, yBoundaries, color = 'red')
plt.xlim([0, l])
plt.ylim([(A + A/100), -(A + A/100)])
plt.pause((1/(b*tmax*10**16)))
i = i + 1