In a linear ansatz with 2 basis functions: ψ = c1φ1 + c2φ2 we get:
E = (c12<φ1/H/φ1> + 2c1c2<φ1/H/φ2> + c22<φ2/H/φ2>) / (c12<φ1/φ1> + 2c1c2<φ1/φ2> + c22<φ2/φ2>)
Using the usual abbreviations the equation simplifies to:
E = (c12H11 + 2c1c2H12 + c22H22) / (c12S11 + 2c1c2S12 + c22S22)
Division of the nominator and of the denominator by c22 and abbreviating c1/c2 by γ, we obtain:
E = (γ2H11 + 2γH12 + H22) / (γ2S11 + 2γS12 + S22)
This is the equation used in the program. The basis functions applied are unnormalized Gaussians e-αr2 and e-βr2, respectively. The integrals are:
Hαβ = Sαβ ((3αβ)/(α + β) - 2((α + β)/π)1/2)
Sαβ = (π/(&alpha + β))3/2
Have a look to the source code of this web-page. There you find the program code in (JavaScript).