#importing modules
import math
from __future__ import division
#Variable declaration
n1=1.49; #refractive index of core
n2=1.46; #refractive index of cladding
#Calculation
NA=math.sqrt((n1**2)-(n2**2)); #Numerical aperture
#Result
print "The numerical aperture is",round(NA,1)
#importing modules
import math
from __future__ import division
#Variable declaration
NA=0.5; #numerical aperture of fibre
n0=1; #refractive index of the medium(air)
#Calculation
i=math.asin(NA/n0); #acceptance angle(radian)
i=i*180/math.pi; #angle(degrees)
#Result
print "The acceptance angle is",i,"degrees"
#importing modules
import math
from __future__ import division
#Variable declaration
NA=0.25; #numerical apperture
lamda=0.75; #wavelength(micro m)
a=25; #core radius(micro m)
#Calculation
f=(2*math.pi*a*NA)/lamda; #normalised frequency
Ng=(f**2)/2; #number of guided modes
#Result
print "The number of guided modes is",int(Ng)
#importing modules
import math
from __future__ import division
#Variable declaration
pi=100; #mean optical power launched(micro m)
po=5; #mean optical power at fibre output(micro W)
l=6; #length(km)
#Calculation
S=10*math.log10(pi/po); #signal attenuation(dB)
Sk=S/l; #signal attenuation(dB/km)
#Result
print "The signal attenuation is",round(Sk,3),"dB/km"
#importing modules
import math
from __future__ import division
#Variable declaration
ns=2.89; #sum of refractive indices of core & cladding
nd=0.03; #difference of refractive indices of core & cladding
#Calculation
NA=math.sqrt(ns*nd); #numerical apperture
#Result
print "The numerical apperture for the optical fibre is",round(NA,2)
#importing modules
import math
from __future__ import division
#Variable declaration
NA=0.28; #numerical aperture
a=30; #core radius(micro m)
lamda=0.8; #wavelength(micro m)
#Calculation
f=(2*math.pi*a*NA)/lamda; #normalised frequency
Ng=f**2/2; #number of guided modes
#Result
print "The number of guided modes is",int(Ng)
print "answer in the book varies due to rounding off errors"
#importing modules
import math
from __future__ import division
#Variable declaration
S=2; #signal attenuation(dB/km)
l=1; #length(km)
p0=20; #mean optical power at fibre output(micro W)
#Calculation
pi=p0*10**(S/10); #mean optical power launched into fibre(micro W)
#Result
print "The mean optical power launched into a fibre is",round(pi,1),"micro W"
#importing modules
import math
from __future__ import division
#Variable declaration
S=2.3; #Signal attenuation(dB/km)
l=4; #length(km)
#Calculation
S=S*l; #signal attenuation for 4km in dB
P=10**(S/10); #ratio of mean optical power
#Result
print "ratio of mean optical power is",round(P,1)
#importing modules
import math
from __future__ import division
#Variable declaration
op=1/4; #ratio
#Calculation
#S=10*log(pi/po)
S=10*math.log10(1/op); #signal attenuation(dB)
#Result
print "Signal attenuation is",int(S),"dB"