|
|
|
@ -6,7 +6,7 @@ from sympy.physics.quantum.operator import DifferentialOperator |
|
|
|
from sympy.physics.quantum.qapply import qapply |
|
|
|
from sympy.physics.quantum.state import Wavefunction |
|
|
|
|
|
|
|
from sympy.physics.qho_1d import psi_n |
|
|
|
#from sympy.physics.qho_1d import psi_n |
|
|
|
|
|
|
|
#Some general definitions |
|
|
|
m = Symbol('m', nonzero=True, positive=True) |
|
|
|
@ -19,7 +19,7 @@ f = Function('f') |
|
|
|
# for the harmonic 1d Oscillator with potential V(x) = 1/2 omega^2 x^2 # |
|
|
|
######################################################################## |
|
|
|
|
|
|
|
def ho1dExpectaion(op, n1, n2): |
|
|
|
def ho1dExpectaion(n1, op, n2): |
|
|
|
|
|
|
|
def H(n,y): |
|
|
|
yDiff = Symbol('yp') |
|
|
|
@ -79,7 +79,7 @@ ad = DifferentialOperator(sqrt((m * omega)/(2 * hbar))*(x_var*f(x_var) - (hbar * |
|
|
|
|
|
|
|
|
|
|
|
#Calculate for example <0| H |0> |
|
|
|
pprint(ho1dExpectaion(H,0,0)) |
|
|
|
pprint(ho1dExpectaion(1,E_kin,1)) |
|
|
|
|
|
|
|
|
|
|
|
|