Scaling Problem with Variational Method

$$\def\braket#1{\langle#1\rangle}$$

I am attempting to solve a particular Hamiltonian by variational method. The wavefunction that I have selected is as follows:

$$\Psi = Ne^{\frac{-kr}{2}}\sum_{i=0}^{m-1}\alpha_i(kr)^i$$

$$N=\left(\frac{k^3}{\sum_{i,j}^{m-1}\alpha_i\alpha_j(i+j+2)!}\right)^{\frac{1}{2}}$$

Where $$N$$ is the normalization condition, $$k$$ and the set of $$\alpha$$ are my parameters that I wish to vary for some value of $$m$$. The expectation value for any operator is then:

$$\braket{O} = |N|^2\sum_{i,j}\alpha_i\alpha_jO_{ij} = |N|^2 \braket{O}'$$

Where $$O_{ij}$$ is simply the value of the integral over the $$i$$ and $$j$$ terms. In order to minimize this operator we are trying to find the following:

$$argmin_\alpha\frac{\partial\braket{O}}{\partial \alpha} = N\frac{\partial N}{\partial \alpha} \braket{O}' + |N|^2 \frac{\partial \braket{O}'}{\partial \alpha}.$$

Using gradient descent with some non-zero starting condition for the set $$\alpha$$, I can pretty quickly find solutions. (I have tried random starting conditions, unitary, and a few others, but they all converge to similar results)

As a test of this method, I want to solve a known Hamiltonian, namely the Hydrogen atom. If I use the Hamiltonian for a hydrogen atom, and set $$k$$ and $$m$$ to match the known solution ($$k=\frac{2Z}{na_0}$$,$$m=1$$; see eg Griffiths, Wikipedia, Hyperphysics, etc), then I get the expected $$-13.6$$ eV for the $$n=1, \ell=0$$ state.

Using the same Hamiltonian, but for larger values of $$m$$*, I find that the expectation values of my operators don't seem to yield the sensible results that I had expected. In fact, in order to achieve something close the the true eigenvalue I have to scale my Hamiltonian as so:

$$\braket{H} = (2m-1)\braket{T} + m\braket{V}$$

Where our definitions for these expectation values are as follows:

$$\braket{T} = -\frac{1}{2}|N|^2\sum_{i,j}^{m-1}\alpha_i\alpha_j(i^2+j(j-1)-i(1+2j)-2)(i+j)!\frac{1}{4k}$$ $$\braket{V} = -Z|N|^2\sum_{i,j}^{m-1}\alpha_i\alpha_j(i+j+1)!\frac{1}{k^2}.$$

(Note that since we are assuming this is the ground state of Hydrogen, we are taking $$\ell=0$$).

The scaling factors of $$(2m-1)$$ and $$m$$ were discovered through simple trial-and-error for a wide range of $$m$$, however they achieve almost exactly the same values for $$\braket{H}$$ for all of the $$m$$ that I tested (up to $$m=12$$, as I recall).

Question: Why do I have to use these scaling factors in my equation? Shouldn't the expectation value of the Hamiltonian approach the same value regardless of the value of $$m$$*?

*Note: I realize that for $$m=1$$ this is the eigenfunction of the Hydrogen atom, but for $$m>1$$, as I understand the variational principal, we should get a result that is close to the $$m=1$$ value once $$\alpha$$ have been determined.

Edit: It was pointed out that I might be missing a negative sign, however this was an error transposing the equation into SE, my code has the correct sign and the weird factor still remains.

It seems to me you might have a wrong sign in the variational energy. I was able to reproduce same minimal value $$E_0 = -0.25$$ of the function $$E(\alpha, k) = -T - V$$ at $$k = 1$$, $$\alpha_1 = \dots = \alpha_{m-1} = 0$$ for different values of m. Here $$T$$ and $$V$$ are exactly your expressions.