#Given
import math
lamda_p= 980*10**-9
lamda_s=1550*10**-9
P_in=30 # in mW....
G=100
Ps_max= ((lamda_p*P_in)/lamda_s)/(G-1)
print " \nMaximum input power in mW = ",round(Ps_max,5)
Ps_out= Ps_max + (lamda_p*P_in/lamda_s)
Ps_out= 10*math.log10(Ps_out)
print " \n\nOutput power in dBm = ",round(Ps_out,2)
# Given
import math
Ps_out= 30.0 # in uW...
Ps_in=1.0
Noise_power = 0.5
G= Ps_out/Ps_in
G= 10*math.log10(G)
print " \nThe Gain EDFA in dB = ",round(G,2)
#Given
import math
P0=200.0
P1=90.0
P2=85.0
P3=6.3
# All powers in uW...
coupling_ratio= P2/(P1+P2)*100
print " \n\n Coupling Ratio in % = ",round(coupling_ratio,2)
excess_ratio= 10*math.log10(P0/(P1+P2))
print " \n\n The Excess Ratio in % = ",round(excess_ratio,4)
insertion_loss=10*math.log10(P0/P1)
print " \n\n The Insertion Loss (from Port 0 to Port 1) in dB= ",round(insertion_loss,2)
insertion_loss1=10*math.log10(P0/P2)
print " \n\n The Insertion Loss (from Port 0 to Port 2) in dB= ",round(insertion_loss1,2)
cross_talk=10*math.log10(P3/P0)
print " \n\n The Cross Talk in dB= ",int(cross_talk)
print " \n\n***NOTE: Cross Talk calculated wrognly in book... Value of P3 wrognly taken"
#Given
import math
P0= 300.0
P1=150.0
P2=65.0
P3=8.3*10**-3
# All powers in uW...
splitting_ratio= P2/(P1+P2)*100
print " \n\n Splitting Ratio in %= ",round(splitting_ratio,2)
excess_ratio= 10*math.log10(P0/(P1+P2))
print " \n\n The Excess Ratio in dB= ",round(excess_ratio,4)
insertion_loss=10*math.log10(P0/P1)
print " \n\n The Insertion Loss (from Port 0 to Port 1) in dB= ",round(insertion_loss,2)
cross_talk=10*math.log10(P3/P0)
print " \n\n The Cross Talk in dB= ",round(cross_talk,2)
#Given
import math
N=32.0
Ft=(100-5)/100.0
Total_loss= 10*(1-3.322*math.log10(Ft))*math.log10(N)
print " The total loss in the coupler in dB = ",round(Total_loss,2)
#Given
N=10
L=0.5
alpha=0.4
Lthru=0.9
Lc=1
Ltap=10
Li=0.5
Total_loss= N*(alpha*L +2*Lc +Lthru+Li)-(alpha*L)-(2*Lthru)+(2*Ltap)
print " The total loss in the coupler in dB = ",int(Total_loss)
#Given
del_v=10*10**9
N_eff= 1.5
c=3*10**11 # speed of light in mm/sec
del_L= c/(2*N_eff*del_v)
print " The wave guide length differenc in mm= ",int(del_L)