Solution of nonlinear wave equations of the complex quintic Ginzburg-Landau and nonlinear Schrodinger type