Calculating the frequency and wavelength of electromagnetic waves