Implement a function to solve a generalized eigenvalue problem AV=BVE (where A is a real symmetric matrix, B is a real symmetric positive definite matrix, V is the matrix of the generalized eigenvectors and E is the diagonal matrix with the generalized eigenvalues) via diagonalization of the matrix B. Specifically, the diagonalization of matrix B, given as B=QSQT, where S is a diagnoal matrix with positive elements and Q is an orthogonal matrix, turns the eigenproblem
AV=BVE
AV=QSQTVE .
S-½QTAQS-½ S½QTV = S½QTV E ,
à X = X E ,
à = S-½QTAQS-½ ,
X = S½QTV .
V = QS-½X .
Find the ground state of the hydrogen atom with the Schrödinger equation
(-1/2 d²/dr² - 1/r)u(r) = εu(r),
u(r) = ∑i=1..nciφi(r)
φi(r) = r e-αir²
H c = ε N c
Hij = ∫0∞dr φi(r) (-1/2 d²/dr² - 1/r) φj(r) , Nij = ∫0∞dr φi(r) φj(r) .
∫0∞dr r e-αr² r e-βr² = 1/4 √π (α+β)-3/2 ,
∫0∞dr r e-αr² (d²/dr²) r e-βr² = -3/2 √π αβ (α+β)-5/2 ,
∫0∞dr r e-αr² (1/r) r e-βr² = 1/2 (α+β)-1 .
Try n=1,2,3,... gaussians in your basis and investigate the convergence. The method will probably break down at about 5 Gaussians due to their excessive overlap.