Clear["Global`*"](*Setting default environment*)

$Assumptions =  {ℏ, ω, m, β} ∈ Reals && m > 0 && ω > 0 &&ℏ>0 && β > 0 ;

braket[g_, h_] := Integrate[h*Conjugate[g], {x, -Infinity, Infinity}]


(* f[x_] := ((m*ω)/ (Pi ℏ))^(1/4) E^(-(m*x^2*ω)/(2*ℏ)) *)

(* f[x_] := Sqrt[β] Exp[ - β Sqrt[x^2] ] *)
(*f[x_] := (Sqrt[2]) (E^((-(x^2) (α^4)+(β^2))/(2 (α^2)))) (Sqrt[β]) Erfc[(β/((Sqrt[2]) α))]*)

f[x_] = Sqrt[β] ((E^(β x)) HeavisideTheta[-x]+(E^(-β x)) HeavisideTheta[x] ) ;
f2[x_] = Sqrt[β] E^(-β Abs[x]) ;


harmonicOscHamiltonian[v_] := (1/2)*m*x^2*ω^2*v[x] - (1/(2m))*(ℏ^2)*Derivative[2][v][x]
norm = braket[f[x], f[x]] ;

hF[x_] = harmonicOscHamiltonian[f] // FullSimplify 
hF[x_] = hF[x]/. (E^(2 x β)) HeavisideTheta[-x]+HeavisideTheta[x] -> f2[x] E^(β x)/Sqrt[β]

energy = braket[f2[x], hF[x]]
de = D[energy, β]
Solve[de == 0, β]

(* Not sure how to select the positive real root above.  Doing it manually, and substituting it back in, we have a ground state energy estimate that's Sqrt[2] greater than the actual value for this test function *)
energy /. β->(((Sqrt[m]) (Sqrt[ω]))/((2^(1/4)) (Sqrt[ℏ])))