Kinetic: $$ - \frac{\hbar^{2}}{2m_e} \frac{d^2\psi}{dx^2}\$$
Potential: $$ \frac{1}{2}kx^2 \psi $$ Total Energy: $$ E \psi\ $$
The second one is the acceptable wavefunction for this system. The first one is not square integrable. The third one is not differentiable.
In [0]:
import sympy as sy
from sympy import *
x=Symbol('x')
a=Symbol('a',positive=True)
b=Symbol('b',positive=True)
Wavefunction=a*exp(-x**2/2/b**2)
A=integrate(Wavefunction**2,(x,-oo,+oo)) # calculate the integral of (wavefunc) * (wavefunc*) from -oo to +oo
Wavefunction_normalized=Wavefunction/sqrt(A)
pprint(Wavefunction_normalized)
The normalized wavefunction is:
$$ \frac{e^ \frac{-x^2}{2b^2}} {\pi ^ \frac{1} {4} b ^ \frac{1}{2}}$$
In [0]:
import numpy as np
import matplotlib.pyplot as plt
In [0]:
x_d = np.linspace(-2.5,2.5,100) # x_d=x/b which is the dimensionless length
V=1/2*x_d**2 # in unit of kb^2
# V = 1/2*k*x^2 = 1/2*x_d^2 *k*b^2.
# Since k and b are constant, we can consider kb^2 to be the unit of energy.
Wavefunction2_normalized=Wavefunction**2/A
print(Wavefunction2_normalized)
Wavefunction2_normalized=np.exp(-x_d**2)/(sqrt(pi)) # in unit of 1/b
#normalized_wavefunction^2 = exp(-x^2/b^2)/sqrt(pi)/b = exp(-x_d**2)/(sqrt(pi))/b
#Since b is constant, we can consider b to be the unit of length.
fig, ax1 = plt.subplots()
color = 'tab:green'
ax1.set_xlabel('x (b)')
ax1.set_ylabel('V (kb^2)', color=color)
ax1.plot(x_d, V, color=color, label='V(x)')
ax1.tick_params(axis='y', labelcolor=color)
plt.legend(loc='upper left')
ax2 = ax1.twinx() # instantiate a second axes that shares the same x-axis
ax2.set_ylabel('Wavefunction2_normalized (1/b)') # we already handled the x-label with ax1
ax2.plot(x_d, Wavefunction2_normalized,label='Wavefunc2_norm')
plt.legend(loc='lower left')
plt.title('V(x) & Wavefunction2_normalized')
Out[0]:
In [42]:
# Analytical solution
Wavefunction2_normalized=Wavefunction**2/A
print(Wavefunction2_normalized)
#normalized_wavefunction^2 = exp(-x^2/b^2)/sqrt(pi)/b = exp(-x_d**2)/(sqrt(pi)*b)
x_d=Symbol('x_d')
b=Symbol('b', positive = True)
Prob=integrate(exp(-x_d**2)/(sqrt(pi)),(x_d,0,1))
float(Prob)
Out[42]:
Prob = $$\int_{0}^{b} \frac{e^ \frac{-x^2}{b^2}} { \pi^\frac{1}{2} b} dx =\int_{0}^{1} \frac{e^{-x_d^2}} { \pi^\frac{1}{2}b} b*dx_d =\int_{0}^{1} \frac{e^{-x_d^2}} { \pi^\frac{1}{2}} dx_d$$
In [0]:
m=Symbol('m',positive=True)
b=Symbol('b',positive=True)
h=Symbol('h',positive=True)
k=h**2/b**4/m
x = sy.Symbol('x')
der2 = Wavefunction_normalized.diff(x,2)
E1=(der2*(-h**2)/2/m+1/2*k*x**2*Wavefunction_normalized)/Wavefunction_normalized
E1= simplify(E1)
if x in E1.free_symbols: # check if E1 is a function of x or not
print('No. The normalized wavefunction is not a solution of Schrodinger equation.')
else:
print('Yes. The normalized wavefunction is a solution of Schrodinger equation.')
print('The total energy is', E1)
In [0]:
import numpy as np
der1 = Wavefunction_normalized.diff(x,1)
Eigenvalue=complex(0,-1)*h*der1/Wavefunction_normalized
if x in Eigenvalue.free_symbols: # check if Eigenvalue is a function of x or not
print('No. It is not an eigenfunction of the linear momentum operator.')
else:
print('Yes. It is an eigenfunction of the linear momentum operator.')
In [0]:
# Not a eigenfunction
print('No. Because this wavefunction is not an eigenfunction of momentum.')
print('Only the eigenfunction of momentum can give us a single result.')
In [0]:
# Momentum operator
der1 = Wavefunction_normalized.diff(x,1)
P1 = complex(0,-1)*h*der1 # First momentum operator
Ep_p= integrate(P1*Wavefunction_normalized,(x,-oo,+oo))
print('Expectation value is equal to ', Ep_p)
In [0]:
# Momentum operator^2
der2 = Wavefunction_normalized.diff(x,2)
Ep_p2= integrate(-h**2*der2*Wavefunction_normalized,(x,-oo,+oo))
dp=sqrt(Ep_p2-Ep_p*2)
print('The uncertainty in the momentum of the electron is ' ,dp)
In [0]:
dx=h/2/dp
print('The maximum precision with the position of the electron is ',dx)
In [0]:
x = np.linspace(-5,5,300)
Wavefunction_normalized=Wavefunction/sqrt(A)
print(Wavefunction_normalized)
b=1
Wavefunction_normalized=np.exp(-x**2/(2*b**2))/(pi**(1/4)*sqrt(b))
plt.plot(x,Wavefunction_normalized)
plt.xlabel('x')
plt.ylabel('Wavefunction_normalized')
plt.title('Wavefunction_normalized')
print('It is non-zero all the way to infinity as long as A is a finite value. ')