import math
##Example 24.1
##Fiber optics
##given values
n=1.5;##refractive index
x=.0005;##fractional index difference
##calculation
u=n*(1-x);
print'%s %.2f %s'%('cladding index is',u,'');
alpha=math.asin(u/n)*180/math.pi;
print'%s %.2f %s'%('critical internal reflection angle(in degree) is',alpha,'');
theta=math.asin(math.sqrt(n**2-u**2))*180/math.pi;
print'%s %.2f %s'%('critical acceptance angle(in degree) is',theta,'');
N=n*math.sqrt(2.*x);
print'%s %.2f %s'%('numerical aperture is',N,'');
import math
##Example 24.2
##calculation of acceptance angle
##given values
n=1.59;##cladding refractive index
u=1.33;##refractive index of water
N=.20;##numerical aperture offibre
##calculation
x=math.sqrt(N**2+n**2.);##index of fibre
N1=math.sqrt(x**2-n**2.)/u;##numerical aperture when fibre is in water
alpha=math.asin(N1)*180./math.pi;
print'%s %.2f %s'%('acceptance angle in degree is',alpha,'');
import math
##Example 24.3
##calculation of normalised frequency
##given values
n=1.45;##core refractive index
d=.6;##core diametre in m
N=.16;##numerical aperture of fibre
l=.9*10**-6.;##wavelength of light
##calculation
u=math.sqrt(n**2.+N**2.);##index of glass fibre
V=math.pi*d*math.sqrt(u**2.-n**2.)/l;
print'%s %.2f %s'%('normalised frequency is',V,'');
import math
##Example 24.4
##calculation of normailsed frequency and no of modes
##given values
n=1.52;##core refractive index
d=29*10**-6.;##core diametre in m
l=1.3*10**-6.;##wavelength of light
x=.0007;##fractional refractive index
##calculation
u=n*(1.-x);##index of glass fibre
V=math.pi*d*math.sqrt(n**2-u**2)/l;
print'%s %.2f %s'%('normalised frequency is',V,'');
N=V**2./2.;
print'%s %.2f %s'%('no of modes is',N,'');
import math
##Example 24.5
##calculation of numerical aperture and maximum acceptance angle
##given values
n=1.480;##core refractive index
u=1.47;##index of glass
l=850*10**-9.;##wavelength of light
V=2.405;##V-number
##calculation
r=V*l/math.sqrt(n**2-u**2)/math.pi/2;##in m
print'%s %.2f %s'%('core radius in micrometre is',r*10**6,'');
N=math.sqrt(n**2-u**2);
print'%s %.2f %s'%('numerical aperture is',N,'');
alpha=math.asin(N)*180/math.pi;
print'%s %.2f %s'%('max acceptance angle is',alpha,'');
import math
##Example 24.6
##calculation of power level
##given values
a=3.5;##attenuation in dB/km
Pi=.5*10**-3.;##initial power level in W
l=4.;##length of cable in km
##calculation
Po=Pi*10**6./(10**(a*l/10.));
print'%s %.2f %s'%('power level after km(in microwatt) is',Po,'');
import math
##Example 24.7
##calculation of power loss
##given values
Pi=1*10**-3.;##initial power level in W
l=.5;##length of cable in km
Po=.85*Pi
##calculation
a=(10./l)*math.log10(Pi/Po);
print'%s %.2f %s'%('loss in dB/km is',a,'');