Grating equation