# Given
import math
alpha= 3 # average loss Power decreases by 50% so P(0)/P(z)= 0.5
lamda= 900*10**-9 # wavelength
z= 10*math.log10(0.5)/alpha # z is the length
z= z*-1
print " The length over which power decreases by 50% in Kms= ",round(z,2)
z1= 10*math.log10(0.25)/alpha # Power decreases by 75% so P(0)/P(z)= 0.25
z1=z1*-1 # as distance cannot be negative...
print " \n\nThe length over which power decreases by 75% in Kms= ",round(z1,2)
# Given
z=30.0 # Length of the fibre in kms
alpha= 0.8 # in dB
P0= 200.0 # Power launched in uW
pz= P0/10**(alpha*z/10)
print " The output power in uW =",round(pz,4)
# Given
import math
z=8.0 # fibre length
p0= 120*10**-6 # power launched
pz= 3*10**-6
alpha= 10*math.log10(p0/pz) # overall attenuation
print " The overall attenuation in dB =",round(alpha,2)
alpha = alpha/z # attenuation per km
alpha_new= alpha *10 # attenuation for 10kms
total_attenuation = alpha_new + 9 # 9dB because of splices
print " \n\nThe total attenuation in dB =",int(total_attenuation)
# Given
z=12.0 # fibre length
alpha = 1.5
p0= 0.3
pz= p0/10**(alpha*z/10)
pz=pz*1000 # formatting pz in nano watts...
print " The power at the output of the cable in W = ",round(pz,2),"x 10^-9"
alpha_new= 2.5
pz=pz/1000 # pz in uWatts...
p0_new= 10**(alpha_new*z/10)*pz
print " \n\nThe Input power in uW= ",round(p0_new,2)
# Given
import math
p0=150*10**-6 # power input
z= 10.0 # fibre length in km
pz= -38.2 # in dBm...
pz= 10**(pz/10)*1*10**-3
alpha_1= 10/z *math.log10(p0/pz) # attenuation in 1st window
print " Attenuation is 1st window in dB/Km =",round(alpha_1,2)
alpha_2= 10/z *math.log10(p0/(47.5*10**-6)) # attenuation in 2nd window
print " \n\nAttenuation is 2nd window in dB/Km =",round(alpha_2,2)
alpha_3= 10/z *math.log10(p0/(75*10**-6)) # attenuation in 3rd window
print " \n\nAttenuation is 3rd window in dB/Km =",round(alpha_3,2)
#Given
import math
p0=3*10**-3
pz=3*10**-6
alpha= 0.5
z= math.log10(p0/pz)/(alpha/10)
print " The Length of the fibre in Km =",int(z)
#Given
import math
z= 10.0
p0= 100*10**-6 # input power
pz=5*10**-6 # output power
alpha = 10*math.log10(p0/pz) # total attenuation
print " The overall signal attenuation in dB = ",round(alpha,2)
alpha = alpha/z # attenuation per km
print " \n\nThe attenuation per Km in dB/Km = ",round(alpha,2)
z_new = 12.0
splice_attenuation = 11*0.5
cable_attenuation = alpha*z_new
total_attenuation = splice_attenuation+cable_attenuation
print " \n\nThe overall signal attenuation for 12Kms in dB = ",round(total_attenuation,1)
#Given
import math
Tf = 1400.0 # fictive temperature
BETA = 7*10**-11
n= 1.46 # RI
p= 0.286 # photo elastic constant
Kb = 1.381*10**-23 # Boltzmann's constant
lamda = 850*10**-9 # wavelength
alpha_scat = 8*math.pi**3*n**8*p**2*Kb*Tf*BETA/(3*lamda**4)
l= 1000 # fibre length
TL = exp(-alpha_scat*l) # transmission loss
attenuation = 10*math.log10(1/TL)
print " The attenuation in dB/Km =",round(attenuation,3)
#Given
import math
alpha = 2
n1= 1.5
a= 25*10**-6
lamda= 1.3*10**-6
M= 0.5
NA= math.sqrt(0.5*2*1.3**2/(math.pi**2*25**2))
Rc= 3*n1**2*lamda/(4*math.pi*NA**3)
Rc=Rc*1000 # converting into um.....
print " The radius of curvature in um =",round(Rc,2)
#Given
lamda = 850 *10**-9
sigma= 45*10**-9
L= 1
M= 0.025/(3*10**5*lamda)
sigma_m= sigma*L*M
sigma_m= sigma_m*10**9 # formatting in ns/km....
print " The Pulse spreading in ns/Km =",round(sigma_m,2)
print " \n\nNOTE*** - The answer in text book is wrongly calculated.."
#Given
lamda= 2*10**-9
sigma = 75
D_mat= 0.03/(3*10**5*2)
sigma_m= 2*1*D_mat
sigma_m=sigma_m*10**9 # Fornamtting in ns/Km
print " The Pulse spreading in ns/Km =",int(sigma_m)
D_mat_led= 0.025/(3*10**5*1550)
sigma_m_led = 75*1*D_mat_led*10**9 # in ns/Km
print " \n\nThe Pulse spreading foe LED is ns/Km =",round(sigma_m_led,2)
#Given
lamda = 850
sigma= 20
D_mat = 0.055/(3*10**5*lamda)
sigma_m= sigma*1*D_mat
D_mat=D_mat*10**12 # in Ps...
sigma_m=sigma_m*10**9 # in ns # #
print " The material Dispersion in Ps/nm-Km =",round(D_mat,2)
print " \n\nThe Pulse spreading in ns/Km =",round(sigma_m,4)
#Given
n2= 1.48
dele = 0.2
lamda = 1320
Dw = -n2*dele*0.26/(3*10**5*lamda)
Dw=Dw*10**10 # converting in math.picosecs....
print " The waveguide dispersion in math.picosec/nm.Km =",round(Dw,3)
#Given
t= 0.1*10**-6
L= 12
B_opt= 1/(2*t)
B_opt=B_opt/1000000 # converting from Hz to MHz
print " The maximum optical bandwidth in MHz. =",int(B_opt)
dele= t/L # Pulse broadening
dele=dele*10**9 # converting in ns...
print " \n\nThe pulse broadening per unit length in ns/Km =",round(dele,2)
BLP= B_opt*L # BW length product
print " \n\nThe Bandwidth-Length Product in MHz.Km =",int(BLP)
#Given
t= 0.1*10**-6
L= 10.0
B_opt= 1/(2*t)
B_opt=B_opt/1000000 # converting from Hz to MHz
print " The maximum optical bandwidth in MHz. =",int(B_opt)
dele= t/L
dele=dele/10**-6 # converting in us...
print " \n\nThe dispersion per unit length in us/Km =",round(dele,2)
BLP= B_opt*L
print " \n\nThe Bandwidth-Length product in MHz.Km =",int(BLP)
#Given
t= 0.1*10**-6
L=15
B_opt= 1/(2*t)
B_opt=B_opt/1000000 # converting from Hz to MHz
print " The maximum optical bandwidth in MHz. =",int(B_opt)
dele= t/L*10**9 # in ns...
print " \n\nThe dispersion per unit length in ns/Km =",round(dele,2)
#Given
lamda = 0.85*10**-6
rms_spect_width = 0.0012*lamda
sigma_m= rms_spect_width*1*98.1*10**-3
sigma_m=sigma_m*10**9 # converting in ns...
print " The Pulse Broadening due to material dispersion in ns/Km =",round(sigma_m,2)
#Given
import math
L= 5.0 # in KM
n1= 1.5
dele= 0.01
c= 3*10**8 # in m/s
delta_t = (L*n1*dele)/c
delta_t=delta_t*10**12 # convertin to nano secs...
print " The delay difference in ns =",round(delta_t,1)
sigma= L*n1*dele/(2*math.sqrt(3)*c)
sigma=sigma*10**12 # convertin to nano secs...
print " \n\nThe r.m.s pulse broadening in ns =",round(sigma,2)
B= 0.2/sigma*1000 # in Mz
print " \n\nThe maximum bit rate in MBits/sec =",round(B,2)
BLP = B*5
print " \n\nThe Bandwidth-Length in MHz.Km =",round(BLP,2)
#Given
import math
del_t_inter = 5*1
del_t_intra = 50*80*1
total_dispersion = math.sqrt(5**2 + 0.4**2)
print " Total dispersion in ns =",round(total_dispersion,3)
#Given
t= 0.1*10**-6
L=15
dele= t/L*10**9 # convertin to nano secs...
print " The Pulse Dispersion in ns =",round(dele,2)
B_opt= 1/(2*t)/10**6 # convertin to nano secs...
print " \n\n The maximum possible Bandwidth in MHz =",int(B_opt)
BLP = B_opt*L
print " \n\nThe BandwidthLength product in MHz.Km =",int(BLP)
#Given
L= 6
n1= 1.5
delt= 0.01
delta_t = L*n1*delt/(3*10**8)*10**12 # convertin to nano secs...
print " The delay difference in ns =",int(delta_t)
#Given
import math
Lb= 0.09
lamda= 1.55*10**-6
delta_lamda = 1*10**-9
Bf= lamda/Lb
Lbc= lamda**2/(Bf*delta_lamda)
print " The modal Bifriengence in meters =",round(Lbc,2)
beta_xy= 2*math.pi/Lb
print " \n\nThe difference between propogation constants =",round(beta_xy,2)
#Given
t= 0.1*10**-6
B_opt= 1/(2*t)/1000000
print " The maximum possible Bandwidth in MHz =",int(B_opt)
#Given
t= 0.1*10**-6
B_opt= 1/(2*t)/1000000
print " The maximum possible Bandwidth in MHz =",int(B_opt)