In Schrödinger's Quantisation as an Eigenvalue Problem he solves the Hydrogen atom through a precursor of Schrödinger's Equation, derived from the Hamilton-Jacobi equation through a variational method as follows. Starting from the Hamilton-Jacobi Equation $$H\left(q,\frac{\partial S}{\partial q}\right)=E$$ We introduce a variable $\psi$ such that $$S=K\ln\psi$$ The H-E Equation becomes $$H\left(q,\frac{K}{\psi}\frac{\partial \psi}{\partial q}\right)=E$$ Which, in the non-relativistic limit, can be expressed in a quadratic form, such as (for the hydrogen atom) $$\left(\frac{\partial \psi}{\partial x}\right)^2+\left(\frac{\partial \psi}{\partial y}\right)^2+\left(\frac{\partial \psi}{\partial z}^2\right)-\frac{2m}{K^2}\left(E+\frac{e^2}{r}\right)\psi^2=0$$ Schrödinger then suggests that, instead of solving this equation, to find an equation $\psi$, such that the integral over all space of the previous equation is stationary, such that $$\delta J=\delta\int\int\int dxdydz\left[\left(\frac{\partial \psi}{\partial x}\right)^2+\left(\frac{\partial \psi}{\partial y}\right)^2+\left(\frac{\partial \psi}{\partial z}^2\right)-\frac{2m}{K^2}\left(E+\frac{e^2}{r}\right)\psi^2\right]=0$$ My first problem is I don't understand the motivation for this. Is there a reason or was it just a lucky guess?
Second, Schrödinger then makes this equation into $$\frac{1}{2}\delta J =\int df \delta\psi \frac {\partial \psi}{\partial n}-\int\int\int dx dy dz d\psi\left[\nabla^2\psi+\frac{2m}{K^2}\left(E+\frac{e^2}{r}\right)\psi\right]=0$$ Where $df$ is the surface element of the infinite closed surface inside of which the integral is evaluated.
I don't know how to get this integral from the first one, and I have no idea what $n$ is. Please help.