#given
f1=-12.0 #Focal length of a converging lens in cm
f2=25.0 #Focal length of a diverging lens in cm
d=8 #Distance between the lens in cm
#Calculations
C=(1/f1)+(1/f2)+(d/(f1*f2))
D=(d/f2)+1
A=(d/f1)+1
O1F1=(-D/C)
O2F2=(A/C)
O1H1=(1-D)/C
O2H2=(A-1)/C
#Output
print"Position of cardinal points are O1F1 = ",round(O1F1,3),"cm, O2F2 = ",round(O2F2,3),"cm, O1H1 = ",round(O1H1,3),"cm, O2H2 = ",round(O2H2,3),"cm"
print"The system is in air, therfore, nodal points coincide with unit points"
#given
f=15.0 #Focal length of achromatic doublet made up of crown and flint glasses in cm
fl=(0.01506,0.02427) #Dispersive power of crown and flint glasses respectively
#Calculations
#Solving two equations
#(1/f)=(1/f1)+(1/f2)
#(f1/f2)=(-0.01506/0.02427)
fx=(fl[0]/fl[1])
f2=(-(1/fx)+1)/(1/f)
f1=(-fx*f2)
#Output
print"Focal length of converging lens is ",round(f2,1),"cm"
print"Focal length of diverging lens is ",round(f1,1),"cm"
#given
f=20.0 #Focal length in cm
fl=(0.015,0.019) #Dispersive powers of crown and flint glasses respectively
r=(1.495,1.53) #Refractive indices respectively
#Calculations
fx=-(fl[0]/fl[1])
#Solving two equations
#(1/f)=(1/f1)+(1/f2)
#(f1/f2)=(-0.015/0.019)
f2=((1/fx)+1)/(1.0/f)
f1=(fx*f2)
r2=(r[1]-1)*f2
r1=1/(((1/f1)/(r[0]-1))+(1/r2))
#Output
print"Radius of curvature of converging lens is ",round(r2,1),"cm"
print"Radius of curvature of diverging lens is ",round(r1,1),"cm"
#given
r=1.5 #Refractive index of the material of a thin lens
f=-20.0 #Focal length of the lens in cm
rx=-6.0 #Ratio of radii of curvature of lens
#Calculations
r1=1/((1/f)/((r-1)*(1-(1/rx))))
r2=(rx*r1)
#Output
print"Radii of curvature of lens are ",round(r1,2),"cm and",r2,"cm"