from __future__ import division
from numpy import arcsin, sqrt, pi
#Numerical Aperture and critical angle
n1=1.46 #refractive index
d=0.01 #difference
na=n1*sqrt(2*d) #numerical aperture
x=1-d #
oc=arcsin(x)*180/pi #in degree
print "numerical aperture = ",round(na,2)
print "critical angle at core cladding interface =",round(oc,1)," degree"
from __future__ import division
from numpy import arcsin, sqrt, pi
#Numerical Aperture ,critical angle and acceptance angle
n2=1.45 #core refrative index
n1=1.49 #cladding refrative index
oc=arcsin(n2/n1)*180/pi #in degree
na=sqrt(n1**2-n2**2) #numerical aperture
pc=arcsin(na)*180/pi #degree
print "critical angle is =",round(oc,2)," degree"
print "numerical aperture =",round(na,3)
print "acceptance angle is",round(pc,2)," degree"
# Answer in the book are not accurate.
from __future__ import division
from numpy import arcsin, sqrt, pi
delta = 1.2/100 # Relative refractive difference index
n1=1.45 # Core refractive index
NA= n1*sqrt(2*delta) #computing numerical aperture
Acceptance_angle = arcsin(NA)*180/pi #computing acceptance angle
si = pi*NA**2 #computing solid acceptance angle
print "Numerical aperture is %.3f.\nAcceptance angle is %.2f degree.\nSolid acceptance angle is %.3f radians." %(NA,Acceptance_angle,si)
NA = 0.45 # Numerical Aperture
Acceptance_angle = arcsin(NA)*180/pi #computing acceptance angle.
print "Acceptance angle is %.1f degree." %Acceptance_angle
from numpy import arctan
diameter = 1 #Diameter in centimeter
Focal_length = 10 #Focal length in centimeter
radius=diameter/2 #computing radius
Acceptance_angle = arctan(radius/Focal_length)*180/pi #computing acceptance angle
Conical_full_angle = 2*Acceptance_angle #computing conical angle
Solid_acceptance_angle = pi*Acceptance_angle**2 #computing solid acceptance angle
NA = sqrt(Solid_acceptance_angle/pi) #computing Numerical aperture
print "Numerical aperture is %.2f.\nConical full angle is %.2f degree." %(NA,Conical_full_angle)
from numpy import cos
NA = 0.45 #Numerical aperture
betaB = 45 # Skew ray change direction by 90 degree at each reflection
Meridional_theta = arcsin(NA)*180/pi #computing acceptacne angle for meridoinal ray
Skew_theta = arcsin(NA/cos(betaB*pi/180))*180/pi #computing acceptacne angle for skew ray
print "Acceptacne angle for Meridoinal ray is %.2f degree.\nAcceptance angle for Skew ray %.1f degree." %(Meridional_theta,Skew_theta)
core_diameter=78*10**-6 #core diameter
delta=1.4/100 #relative index difference
lamda=0.8*10**-6 #operating wavelength
n1=1.47 #core refractive index
a=core_diameter/2 #computing core radius
v= 2*3.14*a*n1*sqrt(2*delta)/lamda #computing normalized frequency
M=(v)**2/2 #computing guided modes
print "Normalized Frequency is %.3f.\nTotal number of guided modes are %.1f" %(v,M)
#answer in the book are incorrect.
n1=1.47 #refractive index of core
a=4.3*10**-6 #radius of core
delta=0.2/100 #relative index difference
lamda= 2*3.14*a*n1*sqrt(2*delta)/2.405 #computing wavelength
lamda=lamda*10**9
print "Wavelength of fiber is %d nm." %lamda
#answer in the book is given as 1230nm which is incorrect.
n1=1.482 #refractive index of core
n2=1.474 #refractive index of cladding
lamda=820*10**-9 #Wavelength
NA=sqrt(n1**2 - n2**2) #computing Numerical aperture
theta= arcsin(NA)*180/pi #computing acceptance angle
solid_angle=pi*(NA)**2 #computing solid angle
a=2.405*lamda/(2*3.14*NA) #computing core radius
a=a*10**6
print "Numerical aperture is %.3f.\nAcceptance angle is %.1f degrees.\nSolid angle is %.3f radians.\nCore radius is %.2f micrometer." %(NA,theta,solid_angle,a)
#answer in the book are not accurate.
from numpy import ceil
NA=0.16 #Numerical aperture
n1=1.45 #core refractive index
d=60*10**-6 #core diameter
lamda=0.82*10**-6 #wavelength
a=d/2 #core radius
v=2*3.14*a*NA/lamda #computing normalized frequency
M=v**2/2 #computing guided modes
print "if normalized frequency is taken as %d, then there are %d guided modes." %(ceil(v),M)
#Answer given in the textbook is wrong.
NA=0.2 #Numericla aperture
d=50*10**-6 #Diameter of core
lamda=1*10**-6 #Wavelength
a=d/2 #computing radius
v=2*3.14*a*NA/lamda #computing normalized frequency
Mg=v**2/4 #computing mode volume for parabollic profile
Mg=round(Mg)
print "Normalized Frequency is %.1f.\nTotal number of guided modes are %.d." %(v,Mg)
#answer in the book is wrong
delta=0.015 #relative refractive index
n1=1.48 #core refractive index
lamda=0.85*10**-6 #wavelength
a=(2.4*lamda)/(2*3.14*n1*sqrt(2*delta)) #computing radius of core
d=2*a #computing diameter of core
a=a*10**7
a=round(a,2)
a=a/10
d=d*10**6
print "Core radius is %.1f micrometer.\nCore diameter is %.1f micrometer." %(a,2*a)
print "When delta is reduced by 10 percent-"
delta=0.0015
a=(2.4*lamda)/(2*3.14*n1*sqrt(2*delta)) #computing radius of core
d=2*a #computing diameter of core
a=a*10**7
a=round(a)
a=a/10
d=d*10**6
print "Core radius is %.1f micrometer.\nCore diameter is %.1f micrometer." %(a,2*a)
NA=0.25 #Numericla aperture
d=45*10**-6 #Diameter of core
lamda=1.5*10**-6 #Wavelength
a=d/2 #computing radius
v=2*3.14*a*NA/lamda #computing normalized frequency
Mg=v**2/4 #computing mode volume for parabollic profile
Mg=round(Mg,2)
print "Normalized Frequency is %.2f.\nTotal number of guided modes are %.d." %(v,ceil(Mg) )
#answer in the book for normalized frequency is 23.55, deviation 0.05
NA=0.25 #Numericla aperture
d=45*10**-6 #Diameter of core
lamda=1.2*10**-6 #Wavelength
a=d/2 #computing radius
v=2*3.14*a*NA/lamda #computing normalized frequency
Mg=v**2/4 #computing mode volume for parabollic profile
Mg=round(Mg,2)
print "Normalized Frequency is %.1f.\nTotal number of guided modes are %.d." %(v,Mg)
n1=1.54 #refractive index of core
n2=1.5 #refractive index of cladding
a=25*10**-6 #Radius of core in um
lamda=1.3*10**-6 #Wavelength in m
NA=sqrt(n1**2-n2**2)
v=2*3.14*a*NA/lamda #computing normalized frequency
Mg=v**2/4 #computing mode volume for parabollic profile
lamda_cut_off=v*lamda/2.405 #computing cut off wavelength
lamda_cut_off=lamda_cut_off*10**6
print "Normalized Frequency is %0.f.\nTotal number of guided modes are %.d.\nCut off wavelength is %.1f micrometer." %(v,Mg,lamda_cut_off)
L_BL=8*10**-2 #beat length
Br=2*3.14/L_BL #computing modal briefringence
print "Modal briefringence is %.1f per meter." %Br
from numpy import log10
Pin=500*10**-6 #input power
L=200 #length of fiber
loss=2 #loss associated with fiber
Pin_dbm=10*log10(Pin/(10**-3)) #computing input power in dBm
Pin_dbm=round(Pin_dbm)
Pout_dbm=Pin_dbm-L*loss #computing output power level
Pout= 10**(Pout_dbm/10)
print "Output power is %.2e mW." %Pout
a=4.5*10**-6 #core diameter
delta=0.25/100 #relative index difference
lamda=0.85*10**-6 #operating wavelength
n1=1.46 #core refractive index
v= 2*pi*a*n1*sqrt(2*delta)/lamda #computing normalized frequency
lamda_cut_off=v*lamda/2.405 #computing cut off wavelength
lamda_cut_off=lamda_cut_off*10**9
print "Cut off wavelength is %.d nanometer." %(lamda_cut_off)
print "When delta is 1.25 percent-"
delta=1.25/100
v= 2*pi*a*n1*sqrt(2*delta)/lamda #computing normalized frequency
lamda_cut_off=v*lamda/2.405 #computing cut off wavelength
lamda_cut_off=lamda_cut_off*10**7
lamda_cut_off=round(lamda_cut_off)
lamda_cut_off=lamda_cut_off*100
print "Cut off wavelength is %.d nanometer." %(lamda_cut_off)
a=50*10**-6 #core radius
lamda=1500*10**-9 #operating wavelength
n1=2.53 #core refractive index
n2=1.5 #cladding refractive index
delta=(n1-n2)/n1 #computing delta
v= 2*3.14*a*n1*sqrt(2*delta)/lamda #computing normalized frequency
M=(v)**2/2 #computing guided modes
print "Normalized Frequency is %.1f\nTotal number of guided modes are %.d" %(v,M)
#Calculation error in book. Answer in the book is wrong
core_diameter=8*10**-6 #core diameter
delta=0.92/100 #relative index difference
lamda=1550*10**-9 #operating wavelength
n1=1.45 #core refractive index
a=core_diameter/2 #computing core radius
v= 2*pi*a*n1*sqrt(2*delta)/lamda #computing normalized frequency
M=(v)**2/2 #computing guided modes
print "Normalized Frequency is %.1f.\nTotal number of guided modes are %.d." %(v,M)
delta=1/100 #relative index difference
n1=1.5 #core refractive index
c=3*10**8
L=6
n2=sqrt(n1**2-2*delta*n1**2) #computing refractive index of cladding
delta_T=L*n1**2*delta/(c*n2) #computing pulse broadning
delta_T=delta_T*10**11
delta_T=round(delta_T)
print "Delay difference between slowest and fastest mode is %d ns/km." %delta_T
print "This means that a pulse broadnes by %d ns after travel time a distance of %d km." %(delta_T,L)
n1=1.48 #core refractive index
n2=1.46 #cladding refractive index
phi = arcsin(n2/n1)*180/pi #computing critical angle
NA = sqrt(n1**2 - n2**2) #computing numericla aperture
theta= arcsin(NA)*180/pi #computing acceptance angle
print "Critical angle is %.2f degrees.\nNumerical aperture is %.3f.\nAcceptance angle is %.2f degree." %(phi,NA,theta)
#answers in the book are wrong.
L_BL=8*10**-2 #beat length
Br=2*3.14/L_BL #computing modal briefringence
print "Modal briefringence is %.1f per meter." %Br
L_BL=0.6*10**-3 #beat length
lamda=1.4*10**-6 #wavelength
L_BL1=70
Bh=lamda/L_BL #computing high briefringence
Bl=lamda/L_BL1 #computing low briefringence
print "High briefringence is %.2e.\nLow briefringence is %.1e."%(Bh,Bl)