In [2]:

```
#Variable Declaration
n1 = 10; # Order of interference maximum for lambda = 7000 angstrom
lambda1 = 7000; # Wavelength of the light, angstrom
lambda2 = 5000; # Wavelength of the light, angstrom
#Calculations
# As W = D*lambda/(2*d) then, x = n1*D*lambda1/(2*d) = n2*D*lambda2/(2*d), solving for n2
n2 = n1*lambda1/lambda2; # Order of interference maximum for lambda = 5000 angstrom
#Result
print "The order of interference maximum for wavelength of 5000 angstrom = %2d "%n2
```

In [4]:

```
from math import *
#Variable Declaration
D = 1.6; # Distance between the slit and the screen, m
a = 0.4; # Distance between the slit and the biprism, m
mu = 1.52; # Refractive index of the material of biprism
W = 1e-004; # Fringe width, m
lamda = 5.893e-007; # Wavelength of light used, m
#Calculations
# As W = lambda*D/(2*a(mu-1)*alpha then
alpha = ((lamda*D)/(2*a*(mu-1)*W))*180/pi; # Angle of biprism, degrees
#Result
print "The angle of the biprism = %3.1f degrees"%alpha
```

In [54]:

```
#Variable Declaration
lamda = 5.890e-7; # Wavelength of source of light, m
mu = 1.6; #refractive index of the mica sheet
#Calculations
# As del_x = W*(mu-1)*t/lambda, where del_x = 3*W, solving for t
t = 3*lamda/(mu-1); # Thickness of the mica sheet, m
#Result
print "The thickness of the mica sheet = %5.3e cm"%(t/1e-02)
```

In [7]:

```
#Variable Declaration
lamda = 6.0e-7; # Wavelength of the monochromatic light, m
D = 1; # Distance between the screen and the two coherent sources, m
W = 5e-004; # Fringe width, m
#Calculations
d = lamda*D/(W*1e-03); # Distance between two coherent sources, mm
print "The distance between the two coherent sources = %3.1f mm"%d
```

In [59]:

```
from math import *
#Variable Declaration
D = 1; # Distance between slits and the screen, m
mu = 1.5; # Refractive index of the material of biprism
a = 0.5; # The distance between the slit and the biprism, m
W = 1.35e-004; # Width of the fringes, m
#Calculations
alpha = (180.-179.)/2*pi/180; # Acute angle of biprism, radian
lamda = 2*a*(mu-1)*alpha*W/D; # Wavelength of light used, m
#Result
print "The wavelength of light used = %4d angstrom"%(lamda/1e-10)
#Incorrect answer in the textbook
```

In [11]:

```
#Variable Declaration
lamda = 6.328e-007; # Wavelength of the monochromatic light, m
D = 40; # Distance between the slits and the screen, m
W = 0.1; # Distance between the interference maxima, m
#Calculations
d = lamda*D/W; # Distance between the slits, m
#Result
print "The distance between the slits = %6.4f mm"%(d/1e-03)
```

In [60]:

```
#Variable Declaration
lamda = 5.0e-007; # Wavelength of the monochromatic light, m
D = 1; # Distance between the silts and the screen, m
d = 5e-004/2; # Half of the distance between the two slits, m
mu = 1.5; # Refractive index of glass
t = 1.5e-006; # Thickness of thin glass plate, m
#Calculations
del_x = D*(mu-1)*t/(2*d);
#Result
print "The lateral shift of central maximum = %3.1f mm"%(del_x/1e-03)
```

In [13]:

```
from math import *
#Variable Declaration
lamda = 6.0e-007; # Wavelength of the light, m
mu = 1.463; # Refrctive index of a soap bubble film
n = 0; # Value of n for smallest thickness
r = 0; # Angle of refraction for normal incidence
#Calculations
# As 2*mu*t*cos(r) = (2*n+1)*lambda/2, solving for t
t = (2*n+1)*lamda/(4*mu*cos(r)); # The thickness of a soap bubble film, m
#Result
print "The thickness of a soap bubble film = %5.1f angstrom"%(t/1e-010)
```

In [14]:

```
#Variable Declaration
D5 = 3.36e-003; # Diameter of Newton's 5th ring, m
D15 = 5.90e-003; # Diameter of Newton's 15th ring, m
m = 10; # Number of ring
R = 1; # Radius of the plano-convex lens, m
#Calculations
lamda = (D15**2-D5**2)/(4*m*R);
print "The wavelength of the light used = %4d angstrom"%(lamda/1e-010)
```

In [15]:

```
#Variable declaration
D10 = 0.005; # Diameter of Newton's 5th ring, m
n = 10; # Order of the ring
lamda = 6.0e-007; # Wavelength of the light used, m
#Calculations&Results
R = (D10**2)/(4*n*lamda); # Radius of the curvature of the lens, m
print "The radius of the curvature of the lens = %6.4f m"%R
t = D10**2/(8*R);
print "The thickness of the corresponding air film = %3.1e m"%t
```

In [64]:

```
from math import *
#Variable declaration
mu = 1.43; # Refractive index of the soap film
n = 0; # Order of fringes for smallest thickness
i = 30; # Angle of incidence, degrees
#Calculations
# As sin(i)/sin(r) = mu, cos(r)
cosr = sqrt(1-(sin(i*pi/180)/mu)**2); # Cosine of angle r
lamda = 6.0e-007; # Wavelength of the light, m
t = (2*n+1)*lamda/(4*mu*cosr); # Thickness of the soap film, m
#Result
print "The thickness of the soap film = %4.2e m"%t
```

In [66]:

```
from math import *
#Variable declaration
lamda = 5.893e-007; # Wavelength of the sodium light, m
mu = 1.42; # Refractive index of the soap film
r = 0; # Angle of refraction, degrees
n = 0; # Order of diffraction for least thickness of dark film
#Calculations&Result
t = (2*n+1)*lamda/(4*mu*cos(r)); # Least thickness of the film that will apear bright, m
print "The least thickness of the film that will appear bright = %5.1f m"%(t/1e-010)
n = 1; # Order of diffraction for least thickness of bright film
t = n*lamda/(2*mu*cos(r)); # Least thickness of the film that will apear dark, m
print "The least thickness of the film that will appear dark = %6.2f m"%(t/1e-010) #incorrect answer in the textbook
```

In [19]:

```
#Variable declaration
lamda = 5.893e-007; # Wavelength of the sodium light, m
#Calculations
# As fringe width of the thin wedge-shaped air film is
# W = lambda/(2*t/20*W), solving for t
t = (10*lamda); # Thickness of the wire separating edges of two plane glass surfaces, m
#Result
print "The thickness of the wire = %5.3e m"%t
```

In [20]:

```
#Variable declaration
lamda = 5.9e-007; # Wavelength of the reflected light, m
n = 10; # Order of the ring
D10 = 0.005; # Diameter of the 10th ring,in m
#Calculations&Result
R = (D10**2)/(4*n*lamda); # Radius of curvature of the lens, m
print "The radius of curvature of the lens = %6.4f m"%R
t = (D10**2)/(8*R); # Thickness of the corresponding air film, m
print "The thickness of the corresponding air film = %4.2e m"%t
```

In [69]:

```
from math import *
#Variable declaration
lamda = 6.328e-007; # Wavelength of monochromatic light from He laser, m
n1 = 1; # First order
n2 = 2; # Second order
l = 6000; # Lines/cm of the diffraction grating
A= 1.66e-6;
#Calculations&Result
theta = degrees(asin(n1*lamda/A));
print "The first order maximum angle = %4.1f degrees"%theta
theta = degrees(asin(n2*lamda/A));
print "The second order maximum angle = %4.1f degrees"%theta
```

In [22]:

```
from math import *
#Variable declaration
a = 1; # For simplicity assume slit width to be unity, unit
theta = 1; # For simplicity assume diffraction angle to be unity, unit
#Calculations
# As a*sin(theta) = m*lambda, solving for lambdas
lambda1 = a*sin(theta); # First wavelength, angstrom
lambda2 = a*sin(theta)/2; # First wavelength, angstrom
#Result
print "lambda1 = %d*lambda2"%(lambda1/lambda2)
```

In [85]:

```
from math import *
#Variable declaration
lamda = 5.5e-7; # Wavelength of light, m
a = 2.2e-6; # Width of the slit, m
l = 6000; # Lines /cm of the diffraction grating
# In a single slit diffraction pattern the directions of minimum intensity are given by a*sintheta = m*lambda where m = 1,2,3
# For m = 1
#Calculations&Results
m = 1; # First order
theta = degrees(asin((m*lamda)/a)); # Angular position of first minima on either side of the central maxima, degrees
print "The angular position of first minima on either side of the central maxima = %.2f degrees"%(theta)
# For m = 2
m = 2; # Second order
theta = degrees(asin(m*lamda/a));
print "The angular position of second minima on either side of the central maxima = %.2f degrees"%(theta)
```

In [94]:

```
#Variable declaration
D = 1.7; # Distance between the slit and the screen, m
W = 2.5e-003; # Given fringe width, m
a = 8e-005; # Width of the first slit, m
b = 4e-004; # Width of the second slit, m
n = b; #
p = [1, 2, 3, 4, 5, 6];
#Calculations&Results
# In a double slit experiment Fraunhoffer diffraction pattern,the fringe width is given by W = lambda*D/n
lamda = b*W/D; # Wavelength of the light used, m
print "The wavelength of light = %4d angstrom"%(lamda/1e-010)
print "The missing orders are:\n"
for i in range(1,6):
s = ((a+b)/a)*i;
print "%d,"%s,
```

In [95]:

```
#Variable declaration
D = 2; # Distance of the screen from the slit, m
x = 1.6e-02; # Position of centre of the second dark band, m
m = 2; # Order of diffraction
a = 1.4e-04; # Width of the slit, m
#Calculations
lamda = (a*x)/(m*D); # Wavelength of light, m
#Result
print "The wavelength of the light = %4d angstrom"%((lamda/1e-010))
#rounding-off error
```

In [30]:

```
#Variable declaration
lambda1 = 5890; # Wavelength of the line, angstrom
lambda2 = 5896; # Wavelength of the line, angstrom
#Calculations
d_lambda = lambda2 - lambda1; # Wavelength difference, angstrom
n = 2; # Order of diffraction
N = lambda2/(n*d_lambda); # Minimum no. of lines in a grating
#Result
print "The minimum number of lines in the grating = %3d lines"%N
```

In [96]:

```
from math import *
#Variable declaration
lamda = 5.0e-07; # Wavelength of the radiation, m
a_plus_b = 2.54e-02/2620; # The grating element, m
theta_max = 90; # Maximum value of angle of diffraction, degrees
#Calculations
n_max = a_plus_b/lamda*sin(theta_max*pi/180); # Maximum number of visible orders
#Result
print "The number of visible orders = %2d "%n_max
```

In [11]:

```
from math import *
#Variable declaration
lambda1 = 6000; # Wavelength of yellow line, angstrom
lambda2 = 4800; # Wavelength of blue line, angstrom
#Calculations
#(a+b)sin(theta) = n*6000 ---1
#(a+b)sin(theta) = (n+1)*4800
#Comparing 1 and 2, we get the following,
n = 48./12
theta = 3./4; # Angle of diffraction, radian
a_plus_b = (n*lambda1)/theta
#Results
print "Grating element = %d A"%a_plus_b
```

In [33]:

```
from numpy import *
#Variable declaration
n = 5; # Order for given wavelength
m = [4, 5, 6, 7, 8]; # Orders of spectral lines in the visible range
lambda1 = 6000; # Wavelength of the spectral line in visible range, angstrom
lambda2 = zeros(5);
print "The spectral lines in visible ranges are:\n"
for i in range(1,5):
l2 = (n*lambda1)/m[i];
lambda2[i] = l2; # Preserve the lambda value
print "%4d angstrom\n"%(l2),
print "The other spectral lines in the visible range 4000A to 7000A are"
for i in range(1,5):
if lambda2[i] < 7000 and lambda2[i] > 4000:
if lambda2[i] == 6000:
continue
#print "%4dA"%lambda2[i]
```

In [35]:

```
#Variable declaration
N = 4500; # Number of lines in grating
n = 2; # Order of diffraction
lambda1 = 5890; # Wavelength, angstrom
lambda2 = 5896; # Wavelength, angstrom
#Calculations&Result
RP2 = n*N; # Resolving power of grating in the second order
lamda = (lambda1+lambda2)/2; # Mean wavelength of sodium light, angstrom
d_lambda = lambda2 - lambda1; # Wavelength difference, angstrom
RP = lamda/d_lambda; # Calculated resolving power of grating
if RP2 <> RP:
print("The D1 and D2 lines of Na light cannot be resolved in second order");
```

In [37]:

```
#Variable declaration
lamda = 5.5e-07; # Wavelength of light used, m
f = 3.0; # Focal length of telescope objective, m
a = 0.01; # Diameter of the telescope objective, m
#Calculations
# As x/f = 1.22*lambda/a, the Rayleigh criterian for resolution, solving for x
x = 1.22*f*lamda/a; # Distance between two stars just seen as separate, m
print "The distance between two stars just seen as separate = %3.1e m "%x
```

In [38]:

```
#Variable declaration
lamda = 5.461e-07; # Wavelength of light used, m
d = 4.0e-07; # Distance between the two luminous objects, m
#Calculations
# As d = 1.22*lambda/(2*mu*sin(alpha)) = 1.22*lambda/(2*NA), solving for NA
NA = 1.22*lamda/(2*d); # Numerical aperature of the objective of microscope
print "The numerical aperature of the objective of microscope = %5.3f "%NA
```

In [39]:

```
#Variable declaration
lamda = 6.0e-07; # Wavelength of light used, m
d_theta = 2.44e-06; # Angular separation between the two stars, radian
#Calculations
a = 1.22*lamda/d_theta; # Aperature of the objective of a telescope from Rayleigh criterian, m
print "The aperature of the objective of the telescope = %3.1f m "%a
```

In [40]:

```
#Variable declaration
lamda = 5.5e-007; # Wavelength of light used, m
x = 1.5e-003; # Distance between the two pinholes, m
a = 4.0e-003; # Diameter of objective, m
#Calculations
D = a*x/(1.22*lamda); # Minimum distance from the telescope at which the the pinhole can be resolved from Rayleigh criterian, m
print "The minimum distance from the telescope at which the the pinhole can be resolved = %4.2f m "%D
```

In [41]:

```
#Variable declaration
lamda = 5.461e-07; # Wavelength of light used, m
d = 5.55e-07; # Distance between the two luminous objects, m
#Calculations
# As d = 1.22*lambda/(2*mu*sin(alpha)) = 1.22*lambda/(2*NA), solving for NA
NA = 1.22*lamda/(2*d); # Numerical aperature of the objective of microscope
print "The numerical aperature of the objective of microscope = %4.2f "%NA
```

In [31]:

```
from math import *
#Variable declaration
i = 60; # Angle of incidence, degrees
mu = tan(i*pi/180); # Brewester's Law to calculate refractive index
A = 60*pi/180; # Angle of prism, degrees
#Calculations
# As mu = sind((A+delta_m)/2)/sind(A/2), solving for delta_m
delta_m = 2*degrees(asin(mu*sin(A/2))) # Angle of minimum deviation for green light for its passage through a prism, degrees
#Result
print "The angle of minimum deviation for green light for its passage through a prism = %.f degrees"%((delta_m-60))
```

In [43]:

```
#Variable declaration
lamda = 5.89e-07; # Wavelength of light used, m
mu_O = 1.55; # Refractive index of ordinary light
mu_E = 1.54; # Refractive index of extraordinary light
#Calculations
tQ = lamda/(4*(mu_O-mu_E)); # The thickness of the quarter wave plate, m
print "The thickness of the quarter plate is = %6.4e m"%tQ
```

In [44]:

```
#Variable declaration
theta = 9.9; # Optical rotation of solution, degrees
l = 20; # Length of the tube, cm
S = 66; # Specific rotation of pure sugar solution, degree per dm-(g/cc)
#Calculations
# As the specific rotation, S = 10*theta/l*c, solving for c
c = 10*theta/(l*S); # Concentration of solution for pure sugar, g/cc
c_prime = 0.080; # Concentration of solution for impure sugar, g/cc
Percentage_purity = c*100/c_prime; # Percentage purity of sugar sample
print "The percentage_purity of the sugar sample = %5.2f percent"%Percentage_purity
```

In [45]:

```
#Variable declaration
theta = 26.4; # Optical rotation of sugar solution, degrees
l = 20; # Length of the tube, cm
c = 0.20; # Concentration of the solution, g/cc
#Calculations
S = 10*theta/(l*c); # The specific rotation of the sugar solution, degree per dm per (g/cc)
print "The specific rotation of the sugar solution = %2d degrees"%S
```

In [43]:

```
from math import *
# Function to convert degrees to deg-min
def deg_to_dms(deg):
d = int(deg)
md = abs(deg - d) * 60
md = round(md)
return [d, md]
lamda = 7.62e-07; # Wavelength of the polarized light, m
mu_R = 1.53914; # Refractive index of quartz for right-handed circularly polarized light
mu_L = 1.53920; # Refractive index of quartz for left-handed circularly polarized light
t = 5.0e-004; # Thickness of the plate, m
theta = pi*t*(mu_L-mu_R)/lamda; # The angle of optical rotation, radian
d = deg_to_dms(theta*180/pi); # Call the conversion function
print "The angle of rotation produced by its plate = ",d
```

In [49]:

```
#Variable declaration
theta = 13.; # Optical rotation of the solution, degrees
l = 20.; # Length of the tube, cm
l_prime = 30.; # New length of the tube, cm
c = 1.; # For simplicity assume concentration of sugar solution to be unity, g/cc
#Calculations
c_prime = c/3; # New concentration of sugar solution, g/cc
# As, S = 10*theta/(l*c) so 10*theta/(l*c) = 10*theta_prime/(l_prime*c_prime)
# Solving for theta_prime
theta_prime = theta/(l*c)*l_prime*c_prime; # The optical rotation produced by new length of sugar solution, degrees
print "The optical rotation of %d cm length of sugar solution = %3.1f degrees"%(l_prime, theta_prime)
```

In [51]:

```
#Variable declaration
theta = 11.; # Optical rotation of sugar solution, degrees
l = 20; # Length of the tube, cm
S = 66; # Specific rotation of sugar solution, degrees
#Calculations
c = theta*10/(l*S); # The concentration of sugar solution, g/cc
print "The strength of the solution = %6.4f g/cc"%c
```

In [53]:

```
#Variable declaration
theta = 20; # Optical rotation of sugar solution, degrees
theta_prime = 35.; # New optical rotation of sugar solution, degrees
c = 5; # Percentage concentration of the solution
c_prime = 10; # New percentage concentration of the solution
l = 1; # For simplicity assume length of the sugar solution to be unity
#Calculations
l_prime = theta_prime*l*c/(c_prime*theta);
print "The length of sugar solution for %d percent concentration and %d degrees optical rotation = %5.3f*l "%(c_prime, theta_prime, l_prime)
```