Solution (source code)

= Solution

Here $p=w=1$ and $q=x^2$ on the whole real line. The <quantum harmonic oscillator> energy form is $Q[\psi]=\int_{\mathbb R}(|\psi'|^2+x^2|\psi|^2)dx$. Admissible trials have a square-integrable <weak derivative> and finite potential energy; they need not have a classical second derivative everywhere.