moved eigenvalue calculation to subroutine, prettied compare_eigenvalues