Consider a particle in a box $\Lambda = [0, L]$. The wavefunction $\psi \in L_D^2(\Lambda)$ where $D$ denotes a Dirichlet Condition $\psi(0)=0=\psi(L)$. We have, then
$$ - \frac{\hbar^{2}}{2m} \frac{d^{2}\psi}{dx^{2}} = E \psi$$
inside de box. Solving this equation,
$$ \psi_{m}(x) = \sqrt{2/L} \sin(n\pi x/L).$$
Now consider a weak formulation of this problem:
$$\frac{\hbar^{2}}{2m} \int_{0}^{L} \frac{d\psi}{dx} \frac{d\varphi}{dx} dx = E \int_{0}^L \psi \varphi dx$$
so that $\varphi \in H^1_0(\Lambda)$. Is it possible to find an analytical solution for this equation? If so, how can one proceed to find solutions of weak formulations in general?