Variational method (shifted Gaussians)

As an example, we calculate the eigenvalues for a 1-dimensional harmonic oscillator potential, given by


This potential is analytically solvable, which allows us to compare our numerical results to the exact solution, which is


The plots appear to indicate that only the lowest 20% of all calculated eigenstates are reasonably accurate.
Plot of the calculated eigenvalues

Plot of the eigenvalues for different numbers of basis functions


Same as the previous plot, but zoomed in


Calculated eigenvalues

   0.5000000000000427
   1.5000000000000053     
   2.5000000000002180     
   3.5000000000096576     
   4.5000000000595559     
   5.5000000018905997     
   6.5000000053569611     
   7.5000001619854242     
   8.5000002137402682     
   9.5000072214736573     
   10.500004039082000     
   11.500182118661902     
   12.500033001961301     
   13.502688336030296     
   14.500061840163101     
   15.523279992805827     
   16.500228727597538     
   17.619265705477822     
   18.513590191540413     
   19.887450534815866     


Code: gauss_1d_c.f90  (you also need linalg.f90)