Compute various integrals that were mentioned in lecture 19 (variational method).

ClearAll[ a, m, lambda, x, psi, psqPsi] ;

(*$Assumptions = {a,m,lambda} > 0 && a ∈ Reals ;*)
$Assumptions = a > 0 && a ∈ Reals && m > 0 && m ∈ Reals && lambda > 0 && lambda ∈ Reals ;

psi[x_, a_]  = E^(-x^2/2/a^2) / Sqrt[ a Sqrt[Pi]] ;

psqPsi[x_,a_] = (-ℏ^2/2/m)D[psi[x,a],{x,2} ]// Simplify ;
psi[x,a] // TraditionalForm
psqPsi[x,a] // TraditionalForm

Integrate[ psi[x,a]^2, {x, -Infinity, Infinity}] 
Integrate[ x^2 psi[x,a]^2, {x, -Infinity, Infinity}]
Integrate[ x^4 psi[x,a]^2, {x, -Infinity, Infinity}]
Integrate[  psi[x,a]  psqPsi[x,a], {x, -Infinity, Infinity}]


e[tomega_,omega_, hb_, m_, lambda_] = hb tomega/2 + hb(omega^2 - tomega^2)/4/tomega + 3 lambda hb^2/(4 m^2 tomega^2)

scale = 10^34 ;
hbar = 1.054572×(10^(-34)) scale;
emass = 9.10938×(10^(-31)) scale;
hbOverM = hbar/emass 
Manipulate[
Plot[e[to,omega, hbar,emass , lambda],{to, 0(*-10 hbOverM*), 10 hbOverM}, AxesLabel -> {(OverTilde["ω"]), "(Subscript[(OverBar[E]), (OverTilde[ω])])"},
PlotRange -> {Automatic, {0,Automatic}}],
{{omega, 0, "ω"},0, 10 hbOverM},
{{lambda, 0, "λ"}, 0, 1}
]

p = DynamicModule[{lambda=0,omega=0.000271`},Plot[e[to,omega,hbar,emass,lambda],{to,0,10 hbOverM},AxesLabel->{(OverTilde["ω"]),"\!\(\*SubscriptBox[OverscriptBox[\(E\), \(_\)], OverscriptBox[\(ω\), \(~\)]]\)"},PlotRange->{Automatic,{0,Automatic}}]]

peeters`exportForLatex["lecture19Fig1a", p]