Two-mode variational bound for a linearly tilted square well (source code)

= Two-mode variational bound for a linearly tilted square well

For the first two sine modes in a width-$a$ infinite well with
$V(x)=9\hbar^2x/(ma^3)$, the Hamiltonian in units $\hbar^2/(ma^2)$ is
$$
\begin{pmatrix}
(\pi^2+9)/2&-16/\pi^2\\
-16/\pi^2&(4\pi^2+9)/2
\end{pmatrix}.
$$
Its lower eigenvalue gives the upper bound
$$
E_0\leq\frac{\hbar^2}{ma^2}
\left[
\frac{5\pi^2+18}{4}
-\sqrt{\frac{9\pi^4}{16}+\frac{256}{\pi^4}}
\right].
$$