These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).

### Exercise 1: Obtain and use information from peer-reviewed literature
Water and air are the two materials involved with producing rainbows we may see in the sky after a thunderstorm. To accurately predict where rainbows will appear, we need to have accurate information about the refractive indices of water and air.
(a) Obtain a copy of "Models for the wavelength dependence of the index of refraction of water", Applied Optics **36** (16), 3785-3787 (1997) by Paul D.T. Huibers, and use Eq. (3) of that paper to generate a plot of the refractive index of water as a function of wavelength in the range from 400 to 650 nm.
(b) Obtain a copy of "Refractive index of air: new equations for the visible and near infrared", Applied Optics **35** (9), 1566-1573 (1996) by Philip E. Ciddor, and use Eq. (1) of that paper to generate a plot of $n_{air}-1$, the deviation of the refractive index of air from unity, as a function of wavelength in the range from 400 to 650 nm.
Which material has the larger change in refractive index over the wavelength range from 400 to 650 nm? Calculate the ratio of the larger change to the refractive index of the material for a wavelength of 400 nm, and comment on the magnitude of the ratio.
###Exercise 2: Deflection angle for a light ray entering a spherical raindrop
Assume that a light ray incident on a spherical raindrop at an angle $\theta_{1i}$ measured with respect to the surface normal undergoes one internal reflection before leaving the raindrop, as shown below.
![Alt Figure: Geometry of a ray incident on a spherical raindrop.](images/rainbows/Rainbowgeometry.png "")`
Show that if $\theta_i \equiv \theta_{1i}$ and $\theta_r \equiv \theta_{1t}$, then the deflection angle $\delta$ of the light ray is (in radians):
$$\delta = 2(\theta_i - \theta_r) + (\pi - 2\theta_r)$$
The deflection angle $\delta$ is the angle between the incident ray and the outgoing ray, and $\theta_r$ is the angle of refraction for the light ray incident from air and entering water. To compute the deflection angle, what quantities must be known?
###Exercise 3: Compute the deflection angle versus incident angle
Generate a plot of the deflection angle $\delta$ as a function of incident angle $\theta_i$ for light rays of wavelength 400 nm that experience one internal reflection in the raindrop. Compare, on the same plot, the deflection angle for light rays of wavelength 650 nm. The two curves should have minima that are close to each other, but not identical. What are the values of the incident angle corresponding to these two minima? Assuming that these minima correspond to the rainbow direction, what direction do you have to look relative to the horizontal to see the bright red band of the rainbow? What direction do you have to look relative to the horizontal to see the bright violet band? Which band appears higher in the sky?
Near the minimum of the deflection function (that is, the $\delta(\theta_i)$ curve), are two rays with slightly different incident angles deflected into different directions? Regarding the brightness of the deflected light perceived by an observer, what is implied by your answer?
###Exercise 4: Where is the secondary (double) rainbow?
Repeat the computation of Exercise 3, but now assume that the ray undergoes *two* internal reflections within the raindrop. In this case, show that the deflection angle is given by
$$
\delta = 2(\theta_i - \theta_r) + 2(\pi - 2\theta_r)
$$
and plot the deflection angle versus the incident angle for rays of wavelength 400 nm and 650 nm. The two curves should have minima that are close to each other, but not identical. What are the values of the incident angle corresponding to these two minima? Assuming that these minima correspond to the rainbow direction, what direction do you have to look relative to the horizontal to see the bright red band of the secondary rainbow? Can a ground based observer see these rays? Do the rays that produce the secondary rainbow enter the top of the raindrop? What direction do you have to look relative to the horizontal to see the bright violet band? Which band appears higher in the sky?
Near the minimum of the deflection function (that is, the $\delta(\theta_i)$ curve), are two rays with slightly different incident angles deflected into different directions? Regarding the brightness of the deflected light perceived by an observed, what is implied by your answer?
###Exercise 5: Crude estimate of the irradiance versus deflection angle for a single wavelength: Primary Rainbow
Assume that the each outgoing ray produces an irradiance that is equal to $I(\theta)=I_0\exp[-(\theta-\delta)^2]$ where here the angles are assumed to be in degrees and the implied width of this distribution is $1^\circ$. (For simplicity, we neglect the loss of intensity during refraction and internal reflection. This is a huge oversimplification, but it allows us to focus on adding up contributions from each ray.) Sum up the contributions from rays uniformly distributed over the scaled impact parameter $\tilde{b}=b/R$ to compute the overall irradiance as a function of deflection angle for light of wavelength 400 nm. Plot the resulting irradiance distribution versus deflection angle for a single wavelength. How does this plot help explain why the rainbow is bright?