from math import *
#Variable declaration
r = 1; # For convenience assume radius of the circle to be unity, unit
alpha = 0.8*r; # Distance of light source from the centre of the spherical shell, unit
#Calculations
cos_phi_by_2 = sqrt((alpha+1)/(4*alpha));
#Result
print "cos(phi/2) = %d/4"%(cos_phi_by_2*4)
#Variable declaration
f1 = 5.; # Focal length of thin convex lens, cm
f2 = 3.; # Focal length of thin convex lens, cm
d = 2.; # Separation between the lenses, cm
#Calculations
F = (1./f1)+(1./f2)-(d/(f1*f2)); # Equivalent focal length of a combination of the two lenses, cm
#Result
print "The equivalent focal length of the combination of lenses = %3.1f cm"%F
#incorrect answers in the textbook
#Variable declaration
P1 = 5; # Power of first converging lens, diopter
P2 = 4; # Power of second converging lens, diopter
d = 0.1; # Separation distance between two lenses, cm
#Calculations
P = P1+P2-d*P1*P2;
f = 1/P*100; # The corresponding value of the focal length of the lens combination, cm
#Result
print "The focal length of the combination of lenses of given powers = %5.2f cm"%f
#Variable declaration
f1 = 30.; # Focal length first convex lens, cm
f2 = -50.; # Focal length of second convex lens, cm
d = 20.; # Separation distance between lenses, cm
#Calculations
F = f1*f2/(f1+f2-d); # Equivalent focal length of a combination of the two lenses, cm
#Result
print "The equivalent focal length of the combination = %4.1f cm"%F
#Variable declaration
f1 = 4.; # Focal length of thin convex lens, cm
f2 = 12.; # Focal length of thin convex lens, cm
d = 8.; # Separation distance between the lenses, cm
#Calculations&Results
F = f1*f2/(f1+f2-d); # Equivalent focal length of the combination, cm
L1H1 = d*F/f2; # Distance of first principal point H1 from first lens, cm
print "The distance of the first principal point H1 from the first lens = %d cm"%L1H1
L2H2 = -d*F/f1; # Distance of first principal point H2 from second lens, cm
print "The distance of the second principal point H2 from the second lens = %d cm"%L2H2
L1F1 = -F*(1-d/f2); # Distance of first focal point F1 from first lens, cm
print "The distance of the first focal point F1 from the first lens = %d cm"%L1F1
L2F2 = F*(1-d/f1); # Distance of second focal point F2 from first lens, cm
print "The distance of the second focal point F2 from the second lens= %d cm"%L2F2
#Variable declaration
f1 = 25.; # Focal length of thin convex lens, cm
f2 = -15.; # Focal length of thin concave lens, cm
d = 15.; # Separation distance between the lenses, cm
#Calculations&Results
# We know that, F = f1*f2/f1+f2-d then
F = f1*f2/(f1+f2-d); # The equivalent focal length of the combination
L1H1 = d*F/f2; # The distance of the first principal point H1 from the first lens, cm
print "The distance of the first principal point H1 from the first lens = %d cm"%L1H1
L2H2 = -d*F/f1; # The distance of the second principal point H2 from the first lens, cm
print "The distance of the second principal point H2 from the second lens = %d cm"%L2H2
L1F1 = -F*(1-d/f2); # The distance of the first focal point F1 from the first lens, cm
print "The distance of the first focal point H1 from the first lens = %d cm"%L1F1
L2F2 = F*(1-d/f1); # The distance of the second principal point F2 from the first lens, cm
print "The distance of the second focal point H2 from the second lens= %d cm"%L2F2
import math
from scipy.linalg import solve
from numpy import *
#Variable declaration
w1 = 0.024; # Magnitude of the print ersive power of first lens
w2 = 0.036; # Magnitude of the print ersive power of second lens
#Calculations
# Let 1/f1 = x and 1/f2 = y, then
# The condition for achromatic combination of two lenses, w1/f1 + w2/f2 = 0 => w1*x + w2*y = 0 --- [i]
F = 90.; # Given focal length, cm
# Also F = 1/f1 + 1/f2 => F = x + y ---- (II)
A = array([[w1 ,w2],[ 1, 1]]); # Square matrix
B = array([0,1/F]); # Column vector
X = solve(A,B)
f1 = 1/X[0]; # Focal length of convex lens, cm
f2 = 1/X[1]; # Focal length of concave lens, cm
#Results
print "The focal length of convex lens = %.f cm"%((f1))
print "The focal length of concave lens = %.f cm"%((f2))
import math
from scipy.linalg import solve
from numpy import *
#Variable declaration
w1 = 0.02; # Magnitude of the dispersive power of first lens
w2 = 0.04; # Magnitude of the dispersive power of second lens
#Calculations
# Let 1/f1 = x and 1/f2 = y, then
# The condition for achromatic combination of two lenses, w1/f1 + w2/f2 = 0 => w1*x + w2*y = 0 --- (I)
F = 20.; # Given focal length of achromatic doublet, cm
# Also F = 1/f1 + 1/f2 => F = x + y ---- (II)
A = [[w1, w2], [1, 1]]; # Square matrix
B = [0,1/F]; # Column vector
X = solve(A,B); # Characteristic roots of the simultaneous equations, cm
f1 = 1/X[0]; # Focal length of convex lens, cm
f2 = 1/X[1]; # Focal length of concave lens, cm
#Results
print "The focal length of convex lens = %2d cm"%(ceil(f1))
print "The focal length of concave lens = %2d cm"%(ceil(f2))
import math
from numpy import *
from scipy.linalg import solve
#Variable declaration
w1 = 0.017; # Magnitude of the print ersive power of first lens
w2 = 0.034; # Magnitude of the print ersive power of second lens
# Let 1/f1 = x and 1/f2 = y, then
# The condition for achromatic combination of two lenses, w1/f1 + w2/f2 = 0 => w1*x + w2*y = 0 --- [i]
F = 40.; # Given focal length of achromatic doublet, cm
# Also F = 1/f1 + 1/f2 => F = x + y ---- (II)
A = [[w1, w2],[ 1, 1]]; # Square matrix
B = [0,1/F]; # Column vector
X = solve(A,B); # Characteristic roots of the simulmath.taneous equations, cm
f1 = 1/X[0]; # Focal length of convex lens, cm
f2 = 1/X[1]; # Focal length of concave lens, cm
# For the convex lens
R2 = -25.; # Radius of curvature of the contact surface, cm
mu = 1.5; # Mean refractive index of crown glass
# From the Lens Maker formula, 1/f = (mu - 1)*(1/R1-1/R2), solving for R1
f = f1;
R1 = 1/(1/(f*(mu-1))+1/R2); # Radius of curvature of second surface of first lens, cm
print "The radius of curvature of second surface of first lens = %5.2f cm"%R1
# For the concave lens
R1 = -25.; # Radius of curvature of the contact surface, cm
mu = 1.7; # Mean refractive index of flint glass
# From the Lens Maker formula, 1/f = (mu - 1)*(1/R1-1/R2), solving for R1
f = f2;
R2 = 1/(1/R1-1/(f*(mu-1))); # Radius of curvature of second surface of second lens, cm
print "The radius of curvature of second surface of second lens = %5.2f cm"%R2
#Variable declaration
# For flint glass
mu_C = 1.665; # Refractive index of flint glass for C line
mu_F = 1.700; # Refractive index of flint glass for F line
#Calculations
mu_D = (mu_F+mu_C)/2; # Refractive index of flint glass for D line
w2 = (mu_F-mu_C)/(mu_D-1); # Magnitude of the dispersive power of second lens of flint glass
# For crown glass
mu_C = 1.510; # Refractive index of crown glass for C line
mu_F = 1.536; # Refractive index of crown glass for F line
mu_D = (mu_F+mu_C)/2; # Refractive index of flint glass for D line
w1 = (mu_F-mu_C)/(mu_D-1); # Magnitude of the dispersive power of second lens of crown glass
f = 50.; # Focal length of acromatic doublet, cm
FD = f*(w2-w1)/w2; # Focal length of D line of the Fraunhofer spectrum due to convex lens of crown glass
FC = FD*(mu_D - 1)/(mu_C - 1); # Focal length of C component of converging lens, cm
#Result
print "The focal length of C component of converging lens = %4.2f cm"%FC
#rounding-off error
#Variable declaration
F = 50.; # Equivalent focal length of combination of two lenses, cm
#Calculations
#d = f1+f2/2, condition for no chromatic aberration (1)
#d = f2-f1, condition for minimum spherical aberration (2)
# From (1) and (2), f1 = 3*d/2, f2 = d/2
# As 1/F = 1/f1 + 1/f2 - d/(f1*f2), solving for d
d = 4./3*50; # Distance of separation betwen two lenses, cm
f1 = 3*d/2,
f2 = d/2;
#Results
print "f1 = %.f cm"%(f1)
print "f2 = %5.2f cm"%(f2)
#Variable declaration
mu_R = 1.5230; # Refractive index for red wavelength
mu_V = 1.5145; # Refractive index for violet wavelength
R1 = 40.; # Radius of curvature for red wavelength, cm
R2 = -10.; # Radius of curvature for violet wavelength, cm
#Calculations
# As 1/f = (mu - 1)*(1/R1 - 1/R2), solving for fV and fR
fV = 1./((mu_V-1)*(1/R1-1/R2)); # Focal length for violet wavelength, cm
fR = 1./((mu_R-1)*(1/R1-1/R2)); # Focal length for violet wavelength, cm
l = fR - fV; # Longitudinal chromatic aberration, cm
#Result
print "The longitudinal chromatic aberration = %5.3f cm"%(abs(l))
#Variable declaration
F = 10; # Equivalent focal length of a combination of two lenses, cm
d = 2; # Separation distance between two lenses, cm
#Calculations
# As d = f1-f2, condition for minimum spherical aberration => f1 = d+f2
# and F = f1*f2/(f1+f2-d), so solving for f2
f2 = 2*F-d; # Focal length of second lens, cm
f1 = d+f2; # Focal length of first lens, cm
#Result
print "f1 = %2d cm, f2 = %2d cm"%(f1, f2)
#Variable declaration
mu = 1.6; # Refractive index of aplanatic surface
R = 3.2; # Radius of curvature, cm
#Calculations&Results
R1 = R/mu; # First radius of the aplanatic surface, cm
print "R1 = %3.1f cm"%R1
R2 = R*mu; # Second radius of the aplanatic surface, cm
print "R2 = %4.2f cm"%R2
#Since the image of an object at one aplanatic point will be formed by the sphere at the other aplantic point,so the is
m = mu**2; # The lateral magnification of the image
print "The lateral magnification of the image = %4.2f"%m
#Variable declaration
mu = 1.52; # Refractive index of aplanatic surface
R = 30; # Radius of curvature, cm
#Calculations&Results
R1 = R/mu; # First radius of the aplanatic surface, cm
print "R1 = %5.2f cm"%R1
R2 = R*mu; # Second radius of the aplanatic surface, cm
print "R2 = %4.1f cm"%R2
#Since the image of an object at one aplanatic point will be formed by the sphere at the other aplantic point,so the is
m = mu**2; # The lateral magnification of the image
print "The lateral magnification of the image = %4.2f"%m
#Variable declaration
F = 5; # Equivalent focal length of Huygens eyepiece, cm
#Calculations
# as f1 = 3*f, f2 = f and d = 2*f, therefore
f = 2./3*F; # Focal length of base lens, cm
f1 = 3*f; # Focal length of field lens, cm
#Result
print "The focal length of the field lens = %2d cm"%f1
#Variable declaration
f = 10; # Given focal length of each lens, cm
f1 = f; # Focal length of first lens, cm
f2 = f; # Focal length of second lens, cm
#Calculations
d = 2./3*f; # Separation distance between two lenses, cm
F = f1*f2/(f1+f2-d); # Equivalent focal length of Ramsden eyepiece, cm
#Result
print "The equivalent focal length of the field lenses is = %3.1f cm"%F
#Variable declaration
d = 10; # Distance between the two thin plano convex lenses in the Huygens eyepiece,
#Calculations&Results
f = d/2; # Base focal length
f1 = 3*f; # Focal length of the first component lens, cm
print "f1 = %d cm"%f1
f2 = f; # Focal length of the second component lens, cm
print "f2 = %d cm"%f2
F = 3./2*f; # Equivalent focal length of the lens, cm
print "F = %3.1f cm"%F
#Variable declaration
F = 4.2; # Equivalent focal length of Ramsden eyepiece, cm
#F = 3/4*f, Equivalent focal length of Ramsden eyepiece,
f = 5.6; #focal length,in cm
#Calculations&Results
f1 = f;
f2 = f;
print "f1 = %3.1f cm"%f1
print "f2 = %3.1f cm"%f2
d = 2./3*f;
print "d = %4.2f cm"%d