About
Developed by E. Behringer
Easy JavaScript Simulation by Fremont Teng and Loo Kang Wee
This set of exercises guides the student in exploring primary and secondary rainbows. It requires the student to generate, observe, and describe plots of the deflection angles for light of different wavelengths and identify rainbow angles for different values of the relative index of refraction.
Subject Area  Waves & Optics 

Levels  First Year and Beyond the First Year 
Available Implementation  Python & Easy JavaScript Simulation 
Learning Objectives 
Students who complete this set of exercises will be able to

Time to Complete  120 min 
This set of exercises may be used in an introductory course that covers optics or in an upperlevel optics course. The first three computational exercises are not demanding, but collectively provide an opportunity to deduce physical consequences (e.g., why is it that the primary and secondary rainbows are bright in particular directions). The last exercise is intended purely as a crude, ‘zeroeth order’ estimate of the irradiance as a function of deflection angle, purposefully neglecting polarization effects. Additional computational exercises have been described by D.S. Amundsen et al., Am. J. Phys. 77 (9), 795798 (2009). An experimental apparatus to explore rainbows up to the 6th order has been described by G. Casini and A. Covello, Am. J. Phys. 80 (11), 10271034 (2012).
For Exercises 3 and 4, the theoretical concepts required are the Law of Refraction and the Law of Reflection, which are standard topics in introductory courses and are usually revisited in intermediate or advanced optics courses.
For Exercise 5, the crude model is nothing more than summing the irradiances associated with different rays, which implicitly assumes that the rays are incoherent with one another. Depending on the course, this can be contrasted with the ideas underlying the derivation of far field diffraction patterns  namely, that one works with the electric fields and carefully accounts for the relative phases of contributions from different parts of an extended source.
EXERCISE 1: OBTAIN AND USE INFORMATION FROM PEERREVIEWED 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), 37853787 (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), 15661573 (1996) by Philip E. Ciddor, and use Eq. (1) of that paper to generate a plot of , 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 1: OBTAIN AND USE INFORMATION FROM PEERREVIEWED 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), 37853787 (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),
15661573 (1996) by Philip E. Ciddor, and use Eq. (1) of that paper to
generate a plot of
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
`
Show
that if
The
deflection angle
EXERCISE 3: COMPUTE THE DEFLECTION ANGLE VERSUS INCIDENT ANGLE
Generate
a plot of the deflection angle
Near
the minimum of the deflection function (that is, the
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
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
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
#
# Rainbows_Exercise_1.py
#
# Plot separately the refractive indices of
# water and air, based on peerreviewed literature
#
# The refractive index of water is taken from
# Eq. 3 of P.D.T Huibers, Applied Optics,
# Vol. 36, No. 16, pp. 37853787 (1997).
#
# The refractive index of air is taken from
# Eq. 1 of P.E. Ciddor, Applied Optics,
# Vol. 35, No. 9, pp. 15661573 (1996).
#
# Written by:
#
# Ernest R. Behringer
# Department of Physics and Astronomy
# Eastern Michigan University
# Ypsilanti, MI 48197
# (734) 4878799
# This email address is being protected from spambots. You need JavaScript enabled to view it.
#
# 20160109 by ERB add plots of index versus wavelength
#
from pylab import figure,plot,xlim,xlabel,ylim,ylabel,grid,title,show
from numpy import linspace
# Define the index of refraction function for water
def water_index(wavelength):
n_H2O = 1.31279 + 15.762/wavelength  4382.0/(wavelength**2) + 1.1455e6/(wavelength**3)
return(n_H2O)
# Define the index of refraction function for air
# Note: wavelength is supposed to be in micrometers
def air_index_minus_one(wavelength):
term1 = 0.05792105/(238.0185  1.0e6/(wavelength**2))
term2 = 0.00167917/(57.362  1.0e6/(wavelength**2))
return(term1+term2)
# Inputs
lambda_lo = 400.0 # low value of the wavelength [nm]
lambda_hi = 700.0 # high value of the wavelength [nm]
npts = 301 # number of points for the array of wavelengths
# Generate the array of wavelengths
wavelengths = linspace(lambda_lo,lambda_hi,npts)
# Calculate the refractive indices
n_water = water_index(wavelengths)
n_air = 1.0 + air_index_minus_one(wavelengths)
#
# Start a new figure. This will be a plot of
# refractive index of water versus wavelength.
figure()
# Set the limits of the horizontal axis
xlim(lambda_lo,lambda_hi)
# Label the horizontal axis
xlabel("\(\\lambda\) [nm]", size = 16)
# Set the limits of the vertical axis
ylim(1.325,1.345)
# Label the vertical axis
ylabel("\(n_{water}\)", size = 16)
# Draw a grid
grid(True)
# Make the title
title("\(n_{water}\) versus wavelength \(\\lambda\)\n Appl. Opt. Vol. 36, Pg. 3785 (1997)")
# Plot the refractive index of water versus wavelength
plot(wavelengths,n_water,"m")
show()
#
# Start a new figure. This will be a plot of
# refractive index of air versus wavelength.
figure()
# Set the limits of the horizontal axis
xlim(lambda_lo,lambda_hi)
# Label the horizontal axis
xlabel("\(\\lambda\) [nm]", size = 16)
# Set the limits of the vertical axis
ylim(2.75e4,2.85e4)
# Label the vertical axis
ylabel("\(n_{air}  1\)", size = 16)
# Draw a grid
grid(True)
# Make the title
title("\(n_{air}  1\) versus wavelength \(\lambda\)\n Appl. Opt. Vol. 35, Pg. 1566 (1996)")
# Plot the refractive index of air minus one
plot(wavelengths,air_index_minus_one(wavelengths),"m")
show()
Exercise 1: Obtain and use information from peerreviewed literature
The plot for the refractive index of water should look like:
`
The plot for the deviation of the refractive index of air from unity should look like:
Exercise 2: Deflection angle for a light ray entering a spherical raindrop
To calculate the deflection angle, one needs to know the refractive index of the air and the water at the particular wavelength and also the angle of incidence of the incoming ray. The laws of refraction and reflection are then applied to obtain the angles of refraction and the angle of reflection for the internal reflection. Students should be able to show that the equalities shown in the figure illustrating the ray/raindrop geometry.
Exercise 3: Compute the deflection angle versus incident angle
The solution for Exercise 3 is:
The
minimum of the deflection function for
Exercise 4: Where is the double (secondary) rainbow?
The solution for Exercise 4 is:
The
minimum of the deflection function for
Exercise 5: Crude estimate of the irradiance versus deflection angle for a single wavelength: Primary Rainbow
The solution for Exercise 5 is:
Note
that irradiance is distributed over a large range of detection angles, and that the irradiance has a peak near (but not at) the minimum of the deflection function for these chosen parameters. If we use an angular width smaller than
Most introductory textbooks mention rainbows and the angles at which they can be observed, but do not necessarily explain why rainbows are bright. This set of exercises is intended to show how irradiance “piles up” around the minima of the deflection functions calculated in Exercises 3 and 4.
Translations
Code  Language  Translator  Run  

Software Requirements
Android  iOS  Windows  MacOS  
with best with  Chrome  Chrome  Chrome  Chrome 
support fullscreen?  Yes. Chrome/Opera No. Firefox/ Samsung Internet  Not yet  Yes  Yes 
cannot work on  some mobile browser that don't understand JavaScript such as.....  cannot work on Internet Explorer 9 and below 
Credits
Fremont Teng; Loo Kang Wee; based on Ernest R. Behringer python code
end faq
Sample Learning Goals
[text]
For Teachers
Refractive Indices of Water and Air JavaScript Simulation Applet HTML5
Instructions
Control Panel
Toggling Full Screen
Reset Button
Research
[text]
Video
[text]
Version:
 https://www.compadre.org/PICUP/exercises/exercise.cfm?I=129&A=rainbows
 http://weelookang.blogspot.com/2018/06/refractiveindicesofwaterandair.html
Other Resources
[text]