Solution (source code)

= Solution

For any normalized trial state $|\psi\rangle$, the spectral decomposition gives the <variational method> bound
$$
E_0\leq\langle\psi|H|\psi\rangle.
$$
Choose a family $|\psi(\alpha)\rangle$, form its Rayleigh quotient, and minimize over the variational parameters. Every resulting value is an upper bound, and the minimum is the best bound within that family.