rayleigh-ritz variational technique