ClearAll[ m, hbar, eps, e , theta, phi, zAtomic, a, psiSquared, psi, display, inner, hamiltonian, energy, hPsi, aMin, eMin, hydrogenGroundStateEnergy, heliumGroundStateEnergy ]

(* declare various variables as Real and > 0 *)
$Assumptions=And@@(#>0&)/@{m, hbar, eps, e, zAtomic, a};

(* ψ(r) *)
psi := E^(-#/a) & ;

(* patterns for pretty print formatting *)
display := {hbar -> ℏ,eps -> (Subscript[ϵ, 0]), zAtomic -> Z } ;

hamiltonian[f_, r_] :=
(-hbar^2/(2 m))Laplacian[f[r] , {r, theta, phi}, "Spherical"] - zAtomic(e^2/(4 Pi eps)) f[r]/r ;

(* <f|g>, for real eigenfunctions that have only radial dependence. *)
inner[f_, g_] := 4 Pi Integrate[ r^2 f[r] g[r], {r, 0, Infinity}]

(* <ψ|ψ> *)
psiSquared := inner[ psi, psi ] ;

(* <r|H|ψ> *)
hPsi[r_] :=hamiltonian[psi, r] // Simplify  ;

(* <ψ|H|ψ>/<ψ|ψ> *)
energy = inner[ psi, hPsi[#] & ]/psiSquared ;

(* Solve ∂E/∂a == 0 *)
s = Solve[ D[energy, {a,1}] == 0,{a}] // First ;

aMin = a /. s  ;
eMin = energy /. s  ;

hydrogenGroundStateEnergy = eMin /. zAtomic -> 1 ;
heliumGroundStateEnergy = 2 eMin /. zAtomic -> 2 ;

(*Results: *)
{#1," = ",#2/. display // TraditionalForm } &@@@{
{"<r|H|ψ>", hPsi[r] },
{"<ψ|H|ψ>/<ψ|ψ>", energy},
{"(Subscript[a, min])",aMin},
{"<ψ|H|ψ>/<ψ|ψ>|a = (Subscript[a, min])", Row[{eMin, "= \!\(\*FractionBox[\(1\), \(4\\ π\\ \*SubscriptBox[\(ϵ\), \(0\)]\\ \*SubscriptBox[\(a\), \(0\)]\)]\)(" ,eMin 4 Pi eps hbar^2/(m e^2) 4 Pi eps, ")"}]},
{"(Subscript[E, H])", Row[{"\!\(\*FractionBox[\(1\), \(4\\ π\\ \*SubscriptBox[\(ϵ\), \(0\)]\\ \*SubscriptBox[\(a\), \(0\)]\)]\)(" ,hydrogenGroundStateEnergy 4 Pi eps hbar^2/(m e^2) 4 Pi eps, ")"}]},
{"(Subscript[E, (Subscript[H, e])])", Row[{"\!\(\*FractionBox[\(1\), \(4\\ π\\ \*SubscriptBox[\(ϵ\), \(0\)]\\ \*SubscriptBox[\(a\), \(0\)]\)]\)(" ,heliumGroundStateEnergy 4 Pi eps hbar^2/(m e^2) 4 Pi eps, ")"}]}
} // Grid