  In this paper, we propose a new numerical method for scattering problems in
periodic waveguide, based on the newly established contour integral
representation of solutions in a previous paper by the author (see [Zhadf]).
For this kind of problems, solutions are obtained via the Limiting Absorption
Principle and we all them LAP solutions. Based on the Floquet-Bloch transform
and analytic Fredholm theory, an LAP solution could be written explicitly as an
integral of quasi-periodic solutions on a contour, which depends on the
periodic structure. Compared to previous numerical methods for this kind of
problems, we do not need to adopt the LAP for approximation, thus a standard
error estimation is easily carried out. Based on this method, we also develop a
numerical solver for the halfguide problems. This method is also based on the
result from [Zhadf], which shows that any LAP solution of a halfguide problem
could be extended into a fullguide problem with a non-vanishing source term(not
uniquely!). So first we approximate the source term from the boundary data by a
regularization method, and then the LAP solution could be obtained from the
corresbonding fullguide problem. At the end of this paper, we also show some
numerical results to present the efficiency of our numerical methods.
