In this talk, we discuss the approximation and computation for the linear and nonlinear eigenvalue problems in photonic crystals. We discretize the shifted Maxwell operator with edge finite elements and construct a penalty term using Lagrange element space. Using the properties of the finite element spaces on discrete de Rham complex, we prove that this penalty term can complement the kernel of the discrete Maxwell operator. Then the discrete Maxwell eigenproblem with the penalty term can be computed almost in the same way as Laplace eigenproblem. We prove that the nonzero eigenpairs of the original discrete Maxwell eigenproblem are free from the influence of the penalty term can be picked up by simple recomputation. We extent the classical spectral approximation theory for compact and bounded operators to general linear operators, and then apply it to polynomial eigenvalue problems (PEP). We also study the essential spectrum in PEPs, and prove that this spectrum is stable under relatively compact perturbations. Based on this analysis, we give some suggestions to make algorithms for solving PEPs more efficient.