Spectral methods in quantum field theory and quantum cosmology