Optical spectra of solids, impurities and superstructures with the recursion and the renormalization methods