HERMITE6 = [ (x)->(1), # Hermite_0 polynomial
(x)->(2x),
(x)->(4x^2-2),
(x)->(8x^3 - 12x),
(x)->(16x^4 - 48x^2 + 12),
(x)->(32x^5 - 160 - 120x) ]
SQRPI = 1.7724538509055159 # square root of pi
function getHermite(n)
return HERMITE6[n+1] # because Jl start indicies at 1
end
function computeHermite(x,n)
f = getHermite(n)
return f(x)
end
function qho_WaveFact(n)
return (1 / sqrt( 2^n * factorial(n) ))
end
function qho_WaveNatX(x,n)
norm = 0.10627834566699294
WF = qho_WaveFact(n)
H_n = computeHermite(x,n)
return ( norm* WF * H_n * exp( -0.5 * x^2 ) )
end
function gaussianPert(x;alpha=4)
return ( (1/alpha)*exp(-0.5x^2) )
end
function qho_EnergyN(n)
norm4 = 0.10627834566699294^4
hBar = 1.05457e-34
return ( (n + 0.5) * norm4 * hBar^2 * pi )
end
wsp = linspace(-10,10,1000)
psi1 = zeros(1000)
phi1 = zeros(1000)
psi2 = zeros(1000)
phi2 = zeros(1000)
gPert1 = zeros(1000)
for i in [1:1000]
psi1[i] = qho_WaveNatX( wsp[i], 0 )
phi1[i] = qho_WaveNatX( wsp[i], 0 )
psi2[i] = qho_WaveNatX( wsp[i], 1 )
phi2[i] = qho_WaveNatX( wsp[i], 1 )
gPert1[i] = gaussianPert( wsp[i] )
end
println(dot( psi1, phi1 ))
println(dot( psi2, phi2 ))
println(dot( psi1, phi2 ))
println(dot( psi2, phi1 ))
for i in [1:1000]
phi1[i] = gPert1[i] * phi1[i]
end
dot(phi1, psi1)
1/sqrt(88.53406985273054)
qho_EnergyN(0)
16 * 4
64 - 3 - 3
58 / 5
58 / 7
acos(2/3)*180/pi
d