from math import sqrt,pi,log
from __future__ import division
Pi=100*10**-6## mean optical power in watt
Po=2*10**-6## output mean power in watt
L=6## length in km
L1=8## length in km
As=10*log(Pi/Po)/log(10)## signal attenuation in dB
as1=As/L## signal attenuation per km
Li=as1*L1## Loss incurred along 8 km
Ls=7## Loss due to splice in dB
as2=Li+Ls## overall signal attenuation in dB
As2=29.4## aprox. overall signal attenuation in dB
Pio=10**(As2/10)## i/p o/p power ratio
print "The signal attenuation =%0.2f dB"%(As)#
print "\n The signal attenuation per km =%0.2f dB/km"%( as1)#
print "\n The trgth =%0.2f km"%( Li)#
print "\n The overall signal attenuation =%0.2f dB"%( as2)#
print "\n The i/p o/p power ratio =%0.2f "%( Pio)
from math import log,pi
from __future__ import division
Pi=1.5*10**-3## mean optical power in watt
Po=2*10**-6## output mean power in watt
a=0.5## dB/km
L=(10*log(Pi/Po)/log(10))/a## max possible link Length in km
print "The max possible link Length =%0.2f km"%( L)
from math import log,pi
from __future__ import division
n=1.46## core refractive index
p=0.286## photoelastic coeff
b=7*10**-11## isothermal compressibility
k=1.381*10**-23## boltzmann's constant
tf=1400## fictive temperature in k
y1=0.85*10**-6## wavelength in m
yr=((8*pi**3)*(n**8)*(p**2)*(b*k*tf))/(3*y1**4)#
e=2.718281828#
akm=e**(-yr*10**3)#
at=10*log(1/akm)/log(10)## attenuation at y=0.85 um
y2=1.55*10**-6## wavelength in m
yr1=((8*pi**3)*(n**8)*(p**2)*(b*k*tf))/(3*y2**4)#
akm1=e**(-yr1*10**3)#
at1=10*log(1/akm1)/log(10)## attenuation at y=1.55 um
y3=1.30*10**-6## wavelength in m
yr2=((8*pi**3)*(n**8)*(p**2)*(b*k*tf))/(3*y3**4)#
akm2=e**(-yr2*10**3)#
at2=10*log(1/akm2)/log(10)## attenuation at y=1.30 um
print "The Loss of an optical fiber =%0.2f dB/km"%( at)#
print "\n The Loss of an optical fiber =%0.2f dB/km"%( at1)#
print "\n The Loss of an optical fiber =%0.2f dB/km"%( at2)
from __future__ import division
d=6## core diameter in m
y=1.55## wavelength in m
a=0.5## attenuation in dB/km
v=0.4#
Pb=4.4*10**-3*d**2*y**2*a*v## threshold power for SBS
Pr=5.9*10**-2*d**2*y*a## threshold power for SRS
print "The threshold power for SBS =%d mw"%( Pb*10**3)#
print "\n The threshold power for SRS =%0.2f W"%( Pr)
from math import sqrt,pi
from __future__ import division
n1=1.46## core refractive index
dl=0.03## relative refractive index difference
y=0.85*10**-6## operating wavelength in m
a=4*10**-6## core radous in m
n2=sqrt(n1**2-2*dl*n1**2)## cladding refractive index
Rc=(3*n1**2*y)/(4*pi*(n1**2-n2**2)**1.5)## critical radius of curvature for multimode fiber
Dl=0.003## relative refractive index difference
N2=sqrt(n1**2-2*Dl*n1**2)##
yc=(2*pi*a*n1*(2*Dl)**0.5)/2.405## cut off wavelength in m
y1=1.55*10**-6## operating wavelength in m
Rcs=(20*y1*(2.748-0.996*(y1/yc))**-3)/(0.005)**1.5## critical radius of curvature for a single mode fiber
print "The critical radius of curvature for multimode fiber =%0.2f um"%( Rc*10**6)##
print "\n The critical radius of curvature for a single mode fiber =%0.2f um"%( Rcs*10**3)
from sympy import log,N
from __future__ import division
x=2## index profile
dl=0.0126## index difference
a=(85/2)*10**-6## core radius
R=2*10**-3## curve of radius
n1=1.45## core refractive index
k=6.28#
y=850*10**-9## wavelength in m
A=(x+2)/(2*x*dl)#
B=(2*a/R)#
C=(3*y/(2*k*R*n1))**(2/3)#
D=B+C#
E=A*D#
F=1-E#
Lm=-10*log(1-A*(B+C))/log(10)## macrobend loss in dB
print "The macrobend loss = ",abs(N(Lm,4)),"dB"#
print "\n The answer is wrong in the textbook"
from math import log,pi
from __future__ import division
Pi=15## optical power in uw
Po=7## ouput power in uw
L=0.15## length in km
Ls=(10*log(Pi/Po)/log(10))/L## Loss of an optical fiber in dB
print "The Loss of an optical fiber =%d dB"%( Ls)
from math import log,pi
from __future__ import division
Pi=200*10**-6## average optical power in watt
Po=5*10**-6## average output power in watt
L=20## in km
L1=12## in km
ns=5## number of attenuation
a=0.9## attenuation in dB
sa=10*log(Pi/Po)/log(10)## signal attenuation
sp=sa/L## signal attenuation per km
sn=sp*L1## signal attenuation for 12 km
sn1=ns*a## attenuation in dB
sn2=sn+sn1## overall signal attenuation in dB
print "The signal attenuation per km =%0.2f dB/km"%( sp)#
print "\n The overall signal attenuation=%0.2f dB "%( sn2)
from math import log,pi
from __future__ import division
Pi=100*10**-6## average optical power in watt
Po=4*10**-6## average output power in watt
L=6## in km
L1=10## in km
sa=10*log(Pi/Po)/log(10)## signal attenuation
sp=sa/L## signal attenuation per km
sn=sp*L1## signal attenuation for 12 km
sn1=sn+9## overall signal attenuation in dB
print "The signal attenuation=%0.2f dB"%( sa)#
print "\n The signal attenuation per km =%0.2f dB/km"%( sp)#
print "\n The overall signal attenuation=%d dB "%( sn1)
from math import log,pi
from __future__ import division
Pi=20*10**-6## average optical power in watt
Po=7.5*10**-6## average output power in watt
sl=10*log(Pi/Po)/log(10)## signal Loss in dB
L=15## in km
L1=30## in km
ns=29## number of attenuation
sp=sl/L## signal Loss per km
sn=sp*L1## signal attenuation for 30 km
sn1=sn+ns## overall signal attenuation in dB
i_o=10**(sn1/20)## input output power ratio
print "The signal Loss =%0.2f dB"%( sl)#
print "\n The signal Loss per km=%0.2f dB/km"%( sp)#
print "\n The overall signal attenuation=%0.2f dB"%( sn1)#
print "\n The input output power ratio=%0.2f"%( i_o)
from math import log,pi
from __future__ import division
Tf=1400## temperature in k
Bc=7*10**-11## in m**2/N
n=1.38##
P=0.29## Photoelastic coefficient
y=0.9*10**-6## wavelength in m
K=1.38*10**-23## boltzman's constant
Rrs=((8*pi**3)*(n**8)*(P**2)*(Bc*Tf*K))/(3*y**4)#
Rrs1=Rrs/10**-3## per km
e=2.718281828## Exponential term
Lkm=e**(-Rrs1)## transmission loss facter
At=10*log(1/Lkm)/log(10)## Attenuation in dB/km
print "The Attenuation=%0.2f dB/km"%( At)
from __future__ import division
y=1.35## wavelength in um
d=5## core diamater in um
a=0.75## attenuation in dB/km
v=0.45## bandwidth in GHz
Pb=4.4*10**-3*(d**2)*(y**2)*(a*v)## threshold optical power for sbs
Pr=5.9*10**-2*(d**2)*(y)*(a)## threshold optical power for sbr
Pbr=Pb/Pr## the ratio of threshold power level
print "The ratio of threshold power level=%0.2f %%"%( Pbr*100)
from math import log,pi,sqrt
from __future__ import division
n1=1.5## core refractive index
y=0.85*10**-6## wavelength in m
dl=0.024## relative refractive index difference
N2=sqrt(n1**2-2*dl*n1**2)## cladding refractive index
n2=1.46#
Rcs=(3*n1**2*y)/((4*pi)*(n1**2-n2**2)**1.5)## critical radius of curvature for multimode fiber
print "The critical radius of curvature =%0.2f um"%( Rcs*10**6)
from math import log,pi,sqrt
from __future__ import division
n1=1.45## core refractive index
y=1.5*10**-6## wavelength in m
dl=0.03## relative refractive index difference
a=5*10**-6## core radius
n2=sqrt(n1**2-2*dl*n1**2)## cladding refractive index
yc=(2*pi*a*n1*sqrt(2*dl))/(2.405)#
Rcs=(20*y*(2.748-0.996*(y/yc))**-3)/(n1**2-n2**2)**1.5## critical radius of curvature for single mode fiber
Rcs1=(3*n1**2*y)/((4*pi)*(n1**2-n2**2)**1.5)## critical radius of curvature for multimode fiber
print "The critical radius of curvature for single mode fiber =%0.2f um"%( Rcs*10**6)#
print "\n The answer is wrong in the textbook"#
print "\n The critical radius of curvature for multimode fiber =%0.2f um"%( Rcs1*10**6)
from math import log,pi
from __future__ import division
L=500/1000## distance in km
Pio=(1/(1-0.75))#
Ls=10*log(Pio)/log(10)/L## Loss in dB/km
print "The Loss =%0.2f dB/km"%( Ls)
from __future__ import division
L=5## length in km
a=0.5## attenuaion loss in dB/km
Po=10**-3*10**(-(a*L)/10)## power level in mW
print "The power level =%0.2f mW"%( Po*10**3)
from math import log,pi
from __future__ import division
L=1## distance in km
Pio=(1/(1-0.40))#
Ls=10*log(Pio)/log(10)/L## Loss in dB/km
print "The Loss =%0.2f dB/km"%( Ls)
from math import log,pi
from __future__ import division
Pi=1*10**-3## input power in watt
Po=0.75*10**-3## output power in watt
a=0.5## in dB/km
L=(10*log(Pi/Po)/log(10))/a## transmission length in km
print "The transmission length =%0.2f km"%( L)
from math import pi
from sympy import log,N
from __future__ import division
y=1300*10**-9## wavelemgth in m
yc=1200*10**-9## cut off wavelength in m
rc=5*10**-6## core diameter in m
n=1.5## refractive index
R=1.2/100## curve of radius in m
dmf=2*rc*((0.65)+0.434*(y/yc)**1.5+0.0149*(y/yc)**6)## mode field diameter
K=(2*pi)/y#
Lm=-10*log(1-(K**4)*(n**4)*((3.95*10**-6)/(8*R**2))**6)/log(10)## macrobend loss
print "The mode field diameter =%0.2f um"%( dmf*10**6)#
print "\n The macrobend loss =%0.2f dB"%abs(N(Lm,4))
print "\n The answer is wrong in the textbook"
from math import log,pi
from __future__ import division
Pi=10*10**-3## input power in watt
Po=8*10**-3## output power in watt
L=0.150## length in km
Ls=(10*log(Po/Pi)/log(10))/L#
print "The transmission length =%0.2f km"%( Ls)