import math
#to calculate critical angle for core-cladding interface
n1=1.5
n2=1.45
thetac=math.degrees(math.asin(n2/n1))
theta1=90-thetac
print "critical angle for core-cladding interface is theta1=",round(theta1),"degree"
#to calculate acceptance angle in air for fibre and corresponding angle of obliquences
na=1
thetaa=math.degrees(math.asin(n1*0.26/na))
print "acceptance angle thetaa=",round(thetaa),"degree"
#to calculate numerical aperture
NA=((n1+n2)*(n1-n2))**(1/2.0)
print "numerical aperture of fibre is NA=",round(NA,4),"unitless"
#to calculate % of light
per=(NA)**2*100
print "light collected is per=",round(per,3),"%"
import math
#to calculate numerical aperture
Del=0.02 #relative refractive index difference between the core and the cladding of the fibre i.e. del=(n1-n2)/n1
n1=1.46 #refractive index of core of W-step index fibre
n2=n1-Del*n1
NA=((n1+n2)*(n1-n2))**(1/2.0)
print "numerical aperture is NA=",round(NA,2),"unitless"
#to calculate critical angle at the core cladding interface within the fibre
thetac=math.degrees(math.asin(n2/n1))
print "thetac=",int(thetac),"degree"
import math
#to calculate refractive index of the cladding
a=35.0*10**-6 #core diameter in micrometre
#formula is del=(n1-n2)/n1
#we get
Del=1.5/100
n1=1.46 #refractive index of the fibre
lamda=0.85*10**-6 #wavelength in micrometer
n2=n1-Del*n1
print "refractive index is n2=",round(n2,3),"unitless"
#to calculate normalised frequency V number of the fibre
V=round((2*math.pi*a*n1*0.173)/lamda,1)
print "normalised frequency V number of the fibre is V=",V,"unitless"
#to calculate total number of guided modes in the fibre
M=(V**2)/2.0
print "total number of guided modes in the fibre is M=",int(M),"modes"
import math
#to calculate cut-off wavelength of the fibre
#(2*del)**(1/2)=(2*(n1-n2)/n1)**(1/2)=(0.005)**(1/2)=0.071
a=5*10**-6 #radius in micrometre
n1=1.46 #core refractive index in micrometre
Vc=2.405 #cut-off value of V parametre for single mode operation
#formula is LAMBDAc=(2*math.pi*a*n1*(2*del)**(1/2))/Vc
lamdac=(2*math.pi*a*n1*0.071)/Vc
print "cut-off wavelength is LAMBDAc=",round(lamdac/1e-6,3),"micrometre"
# answer is slightly different due to approximation in book
import math
#to calculate maximum and minimum value of phase constant
lamda=0.8*10**-6 #wavelength in micrometre
n1=1.6*10**-6
#refractive indices in micrometre
n2=1.44*10**-6
maximum=(2*math.pi*n1)/lamda
minimum=(2*math.pi*n2)/lamda
print "maximum value of phase constant is maximum=",round(maximum,3),"radian/micrometre"
print "minimum value of phase constant is minimum=",round(minimum,3),"radian/micrometre"