This thesis offers new advances in the study of nonlinear Schödinger equation, therefore being of application in different scientific fields. Among them, we pay particular attention to the application in nonlinear optics, keeping an eye in possible applications to condensed matter physics, such as Bose-Einstein condesation in optical lattices. Our aim is to get the effective equations of nonlinear Schrödinger equation for both periodic and quasiperiodic potentials, and fill the theoretical gap that exists in the latter case. These equations describe the dynamics for the envelope of the nonlinear solution, at low energies or long-range. In the periodic case, we made use of Wannier functions basis from the nonlinear stationary problem, instead of the more common approach based on linear Wannier functions, to obtain the corresponding effective equation. It is shown that the equation is, effectively, potential-free. On the other hand, the framework of noncommutative geometry turn out to be the right tool to address the problem in the quasiperiodic case. By cosidering a noncommutative space in two dimensions we obtain an effective equations formally identical to the one obtained in the former periodic case. These equations establish a new theoretical tool to addres the problem of the stability and the existence of nonlinear solutions in the regime of low energies.