#Ex14_1 Pg-695
#Cut-off wavelength
import math
n1=1.545 #core refracrive index
n2=1.510 #cladding refractive index
d=3.*10.**(-6.) #diamter of optical fiber in m
a=d/2. #core radius in m
dela=(n1-n2)/n1 #fractional difference of refractive indices
lamda_c=(2.*math.pi*a*n1*math.sqrt(2.*dela))/2.405 #cut-off wavelength
print '%s %.2f %s' %("Cut-off wavelength =",lamda_c*1e6,"um")
#Ex14_2 Pg-695
#Normalized frequency and total number of guided mode
import math
n1=1.53 #core refracrive index
n2=1.5 #cladding refractive index
lamda=10.**(-6.) #cut-off wavelength
a=50.*10.**(-6.) #core radius in m
V=(2.*math.pi*a*math.sqrt(n1**2.-n2**2.))/lamda #normalised frequency
print '%s %.2f %s' %("Normalised frequency =",V,"\n")
ms=V**2./2. #total number of guided mode
print '%s %.2f %s' %("Total number of guided mode =",ms,"\n")
#Ex14_3 Pg-695
#critical angle, acceptance angle, numerical aperture
import math
n1=1.5#core refracrive index
n2=1.46 #cladding refractive index
asin=1.
tetha_rad=math.asin(n2/n1) #critical angle in radians
tetha=tetha_rad*180./math.pi #critical angle in degree
print '%s %.2f %s' %("Critical angle =",tetha,"degree\n")
tetha_m_rad=math.asin(math.sqrt(n1**2.-n2**2.)) #acceptance angle in radians
tetha_m=tetha_m_rad*180./math.pi
print '%s %.2f %s' %("Acceptance angle =",tetha_m,"degree\n")
NA=math.sin(tetha_m_rad)
print '%s %.2f %s' %("Numerical Apperture =",NA,"\n")
#Ex14_4 Pg-696
#calculate cladding refractive index and RI of the core
import math
NA=0.5 #numerical apperture
n1=1.54 #core refractive index
n2=math.sqrt(n1**2.-NA**2.) #cladding refractive index
print '%s %.2f %s' %("(1)Cladding refractive index =",n2,"\n")
RI=(n1-n2)/n1 #change in core cladding refractive index
print '%s %.2f %s' %("(2)RI of the core =",RI,"\n")
#Ex14_5 Pg-696
#numerical aperture and max entrance angle
import math
n1=1.5#core refracrive index
n2=1.48 #cladding refractive index
n=1.
asin=1.
NA=math.sqrt(n1**2.-n2**2.) #numerical apperture
print '%s %.2f %s' %("(1)Numerical apperture =",NA,"\n")
AA_rad=math.asin(NA/n) #maximum Acceptance angle in rad
AA=AA_rad*180./math.pi #maximum entrance angle in degree
print '%s %.2f %s' %("(2)The maximum entrance angle i0 =",AA,"degree")
#Ex14_6 Pg-697
#core refractive index, numerical aperture,maximum entrance angle
import math
n2=1.59 #cladding refractive index
NA=0.2 #numerical apperture
n0=1. #when fiber is in air
asin=1.
n1=math.sqrt(n2**2.+NA**2.) #core refractive index
print '%s %.2f %s' %("Core refractive index =",n1,"\n")
n=1.33 #water refractive index
NA=math.sqrt(n1**2.-n2**2.)/n0 #numerical apperture
print '%s %.2f %s' %("Numerical apperture =",NA,"\n")
AA_rad=math.asin(NA/n) #maximum Acceptance angle in rad
AA=AA_rad*180./math.pi #maximum entrance angle in degree
print '%s %.2f %s' %("The maximum entrance angle i0 =",AA,"degree")
#Ex14_7 Pg-697
#core refractive index, cladding refractive index
import math
NA=0.22 #numerical apperture
dela=0.012 #fractional difference of refractive indices
n1=NA/(math.sqrt(2.*dela)) #core refractive index
print '%s %.2f %s' %("Core refractive index =",n1,"\n")
n2=n1-dela*n1 #cladding refractive index
print '%s %.2f %s' %("Cladding refractive index =",n2,"\n")
#Ex14_8 Pg-698
#numerical aperture,acceptance angle, critical angle
import math
n1=1.52 #core refracrive index
n2=1.46 #cladding refractive index
dela=(n1-n2)/n1 #fractional difference of refractive indices
asin=1.
NA=n1*math.sqrt(2.*dela) #numerical apperture
print '%s %.2f %s' %("Numerical apperture =",NA,"\n")
AA_rad=math.asin(NA/n1) #maximum Acceptance angle in rad
AA=AA_rad*180./math.pi #maximum entrance angle in degree
print '%s %.2f %s' %("Acceptance angle i0 =",AA,"degree\n")
tetha_rad=math.asin(n2/n1) #critical angle in radians
tetha=tetha_rad*180./math.pi #critical angle in degree
print '%s %.2f %s' %("Critical angle =",tetha,"degree\n")
#Ex14_9 Pg-698
import math
n1=1.45 #core refracrive index
NA=0.16#cladding refractive index
lamda=0.9*10.**(-6.) #cut-off wavelength
d=60./100. #core radius in m
V=(math.pi*d*NA)/lamda #normalised frequency
print '%s %.2f %s' %("Normalised frequency =",V*1e-5,"*1e5\n")
#Ex14_10 Pg-698
#radis of core, numerical apperture, acceptance angle
import math
n1=1.48 #core refracrive index
n2=1.47 #cladding refractive index
lamda=850e-6 #cut-off wavelength
V=2.405 #normalised frequency
asin=1.
n=n1+n2
#In the book cut off wavelength in the question is 850 um but in
# the calcution part it is taken as 850nm. Here Ive taken 850um
d=V*lamda/(math.pi*math.sqrt(n1**2.-n2**2.)) #diamter of core
a=d/2. #radius of core
print '%s %.2f %s' %("Radius of core =",a*1e3,"mm\n")#answer in the book is wrong
NA=math.sqrt(n1**2.-n2**2.) #numerical apperture
print '%s %.2f %s' %("Numerical apperture =",NA,"\n")
AA_rad=math.asin(NA/n) #maximum Acceptance angle in rad
AA=AA_rad*180./math.pi #maximum entrance angle in degree
print '%s %.2f %s' %("Acceptance angle i0 =",AA,"degree\n")
#Ex14_11 Pg-699
#loss in fiber
import math
L=500./1000. #length of fiber in m
Pin=1.*10.**(-3.) #input power in watt
Pout=85./100.*10.**(-3.) #output power in watt
alpha=(10./L)*math.log10(Pin/Pout) #loss
print '%s %.2f %s' %("Loss in the fiber =",alpha,"dB/Km")
#Ex14_12 Pg-699
import math
L=10. #length of fiber in km
alpha=2.5 #loss in the fiber per km
Pin=500.*10.**(-6.) #input power in watt
tot_alpha=-1.*alpha*L #total loss in the fiber
Pout=Pin*10.**(tot_alpha/10.) #output power in watt
print '%s %.2f %s' %("Output power =",Pout*1e6,"uW")
#Ex14_13 Pg-700
#Maximum core diameter which permit single mode operation
import math
dela=1./100. #fractional difference of refractive indices
lamda=1.3*10.**(-6.) #cutoff wavelength in m
n1=1.5 #refractive index
d=6.6*10.**(-6.) #diameter of the core
alpha=2. #loss in fiber
print'%s' %("We have for a GRIN , maximum value of normalized frequency for single mode operation is given by")
print'%s' %("V = 2.4*math.sqrt(1+2/alpha)")
V=2.4*math.sqrt(1.+2./alpha) #normalzed frequency
print'%s' %("For maximum core radiation , we have")
r=V*lamda/(2.*math.pi*n1*math.sqrt(2.*dela)) #radius of the core
print'%s %.2f %s' %("r =",r*1e6,"um\n")
rr=2.*r #diameter of the core
print'%s %.2f %s' %("\nMaximum core diameter which permit single mode operation\n=2*r =",rr*1e6,"um")
#Ex14_14 Pg-700
#Maximum core diameter which permit single mode operation
import math
dela=1.5/100. #fractional difference of refractive indices
lamda=0.85*10.**(-6.) #cutoff wavelength in m
n1=1.48 #refractive index
d=6.6*10.**(-6.) #diameter of the core
V=2.4 #normalzed frequency
print '%s' %("For maximum core radiation,we have")
r=V*lamda/(2.*math.pi*n1*math.sqrt(2.*dela))
print '%s %.2f %s' %("r=",r*1e6,"um\n")
r=1.3*10.**(-6.) #actual radius=1.266 micrometer and assumed to 1.3 micometer
rr=2.*r #diameter of the core
print '%s %.2f %s' %("\nMaximum core diameter which permit single mode operation\n=2*r=",rr*1e6,"um")
#Ex14_15 Pg-701
#attenuation of an optial fiber, output power
import math
alpha=3.5 #loss in fiber
Pi=0.5#input power in milli watt
L=4. #length of fiber in km
print '%s' %("The attenuation of an optical fiber is given by")
print '%s' %("alpha=(10/L)*math.log(Pi/Po)")
Po=Pi/(10.**(alpha*L/10.))
print '%s %.2f %s' %("\nOutput power =",Po*1e3,"mW")
#Ex14_16 Pg-701
#cut-off wavelength expression
import math
n1=1.46 #core refracrive index
r=4.5*10.**(-6.) #radius of the core
dela=0.25/100. #fractional difference of refractive indices
Vc=2.405 #normalzed frequency
print '%s' %("We have, cut-off wavelength expression")
lamda=(2*math.pi*r*n1*math.sqrt(2.*dela))/Vc
print '%s %.2f %s' %("=",lamda*1e6,"um")