Solution (source code)

= Solution

The weight cancels the denominator in the <Sturm-Liouville operator>. Two <integrations by parts>, with real $p,q$, give the <Lagrange identity for a Sturm-Liouville operator>
$$
\begin{aligned}
\langle f,\mathcal Lg\rangle_w-\langle\mathcal Lf,g\rangle_w
&=\int_a^b\left[-f^*(pg')'+(pf^{*\prime})'g\right]dx\\
&=\left[p\left(f^{*\prime}g-f^*g'\right)\right]_a^b.
\end{aligned}
$$
Thus the boundary form must vanish for every pair in the operator domain:
$$
\boxed{\left[p(f^{*\prime}g-f^*g')\right]_a^b=0.}
$$
Separated real <Robin boundary conditions> $A_s y(s)+B_s p(s)y'(s)=0$ at $s=a,b$, with $(A_s,B_s)\ne(0,0)$, make each endpoint contribution vanish. This includes <Dirichlet boundary conditions> and <Neumann boundary conditions>. Coupled conditions can also work: periodic $y(a)=y(b)$ and $p(a)y'(a)=p(b)y'(b)$ cancel the two endpoint contributions. For the regular problem, imposing a complete pair of such self-adjoint <boundary conditions> gives a <self-adjoint differential operator>; the displayed identity is the boundary-form criterion.