#Given
x= 0.07
Eg= 1.424+1.266*x+0.266*x**2
lamda= 1.24/Eg
print " The emitted wavelength in um =",round(lamda,2)
#Given
x= 0.26
y=0.57
Eg= 1.35-0.72*y+0.12*y**2
lamda = 1.24/Eg
print " The wavelength emitted in um =",round(lamda,2)
#Given
Tr = 60*10**-9 # radiative recombination time
Tnr= 90*10**-9 # non radiative recomb time
I= 40*10**-3 # current
t = Tr*Tnr/(Tr+Tnr) # total recomb time
t=t*10**9 # Converting in nano secs...
print " The total carrier recombination life time in ns =",int(t)
t=t/10**9
h= 6.625*10**-34 # plancks const
c= 3*10**8
q=1.602*10**-19
lamda= 0.87*10**-6
Pint=(t/Tr)*((h*c*I)/(q*lamda))
Pint=Pint*1000 # converting inmW...
print " \n\nThe Internal optical power in mW =",round(Pint,2)
#Given
lamda = 1310*10**-9
Tr= 30*10**-9
Tnr= 100*10**-9
I= 40*10**-3
t= Tr*Tnr/(Tr+Tnr)
t=t*10**9 # converting in nano secs...
print " Bulk recombination life time in ns =",round(t,2)
t=t/10**9
n= t/Tr
print " \n\nInternal quantum efficiency =",round(n,3)
h= 6.625*10**-34 # plancks const
c= 3*10**8
q=1.602*10**-19
Pint=(0.769*h*c*I)/(q*lamda)*1000
print " \n\nThe internal power level in mW =",round(Pint,3)
print " \n\n***NOTE: Internal Power wrong in text book.. Calculation Error.."
#Given
nx= 3.6
TF= 0.68
n= 0.3
# Pe=Pint*TF*1/(4*nx**2)
# ne= Pe/Px*100 ..eq0
# Pe = 0.013*Pint # Eq 1
# Pint = n*P # Eq 2
# substitute eq2 and eq1 in eq0
ne = 0.013*0.3*100
print " The external Power efficiency in % =",round(ne,3)
# Wrongly printed in textbook. it should be P instead of Pint in last step
#Given
lamda= 0.85*10**-6
Nint = 0.60
I= 20*10**-3
h= 6.625*10**-34 # plancks const
c= 3*10**8
e=1.602*10**-19
Pint = Nint*h*c*I/(e*lamda)
print " The optical power emitted in W =",round(Pint,4)
TF= 0.68
nx= 3.6
Pe= Pint*TF/(4*nx**2)*1000000
print " \n\nPower emitted in the air in uW =",round(Pe,1)
Pe=Pe/1000000
Nep=Pe/Pint*100
print " \n\nExternal power efficiency in % =",round(Nep,1)
#Given
lamda = 0.87*10**-6
Tr= 50*10**-9
I= 0.04
Tnr= 110*10**-9
t= Tr*Tnr/(Tr+Tnr)
t=t*10**9 # converting in ns...
print " Total carrier recombination life time in ns =",round(t,2)
t=t/10**9
h= 6.625*10**-34 # plancks const
c= 3*10**8
q=1.602*10**-19
n= t/Tr
print " \n\nThe efficiency in % ",round(n,3)
Pint=(n*h*c*I)/(q*lamda)*1000
print " \n\nInternal power generated in mW =",round(Pint,2)
print " \n\n***NOTE- Internal Power wrong in book... "
#Given
V= 2
I= 100*10**-3
Pc= 2*10**-3
P= V*I
Npc= Pc/P*100
print " The overall power conversion efficiency in % =",int(Npc)
#Given
import math
r1= 0.32
r2= 0.32
alpha= 10
L= 500*10**-4
temp=math.log(1/(r1*r2))
Tgth = alpha + (temp/(2*L))
print " The optical gain at threshold in /cm =",round(Tgth,2)
#Given
n= 3.7
lamda = 950*10**-9
L= 500*10**-6
c= 3*10**8
DELv = c/(2*L*n)*10*10**-10 # converting in GHz...
print " The frequency spacing in GHz =",int(DELv)
DEL_lamda= lamda**2/(2*L*n)*10**9 # converting to nm..
print " \n\nThe wavelength spacing in nm =",round(DEL_lamda,2)
print " \n\n***NOTE- The value of wavelength taken wrongly in book"
# value of lamda taken wrongly while soving for DEL_LAMDA inthe book..
#Given
L= 0.04
n= 1.78
lamda= 0.55*10**-6
c= 3*10**8
q= 2*n*L/lamda
q=q/10**5
print " Number of longitudinal modes =",round(q,2),"x 10^5"
del_f= c/(2*n*L)
del_f=del_f*10**-9
print " \n\nThe frequency seperation in GHz =",round(del_f,1)
#Given
Nt= 0.18
V= 2.5
Eg= 1.43
Nep= Nt*Eg*100/V
print " The total efficiency in % =",round(Nep,3)
#Given
n= 3.6
BETA= 21*10**-3
alpha= 10
L= 250*10**-4
r= (n-1)**2/(n+1)**2
Jth= 1/BETA *( alpha + (math.log(1/r)/L))
Jth=Jth/1000 # converting for displaying...
print " The threshold current density =",round(Jth,3),"x 10**3"
Jth=Jth*1000
Ith =Jth*250*100*10**-8
Ith=Ith*1000 # converting into mA...
print " \n\nThe threshold current in mA =",round(Ith,1)
#Given
T= 305.0
T0 = 160.0
T1= 373.0
Jth_32 = exp(T/T0)
Jth_100 = exp(T1/T0)
R_j = Jth_100/Jth_32
print " Ratio of current densities at 160K is =",round(R_j,2)
print " \n\n***NOTE- Wrong in book...\nJth(100) calculated wrongly..."
To = 55
Jth_32_new = exp(T/To)
Jth_100_new = exp(T1/To)
R_j_new = Jth_100_new/Jth_32_new
print " \n\nRatio of current densities at 55K is ",round(R_j_new,2)
# wrong in book...
#Given
import math
Bo= 150
rs= 35*10**-4
a1= 25*10**-6
NA= 0.20
a2= 50*10**-6
Pled = (a1/rs)**2 * (math.pi**2*rs**2*Bo*NA**2)
Pled=Pled*10**10 # converting in uW...
print " The power coupled inthe fibre in uW =",int(Pled)
Pled_new = (math.pi**2*rs**2*Bo*NA**2)
Pled_new=Pled_new*10**6 # converting in uW...
print " \n\nThe Power coupled for case 2 in uW =",round(Pled_new,2)
#Given
import math
n= 1.48
n1= 3.6
R= (n1-n)**2/(n1+n)**2
print " The Fresnel Reflection is ",round(R,4)
L= -10*math.log10(1-R)
print " \n\nPower loss in dB =",round(L,2)
#Given
import math
NA= 0.20
Bo= 150
rs= 35*10**-6
Pled = math.pi**2*rs**2*Bo*NA**2
Pled=Pled*10**10 # convertin in uW for displaying...
print " The optical power coupled in uW =",round(Pled,2)
#Given
import math
n1= 1.5
n=1
R= (n1-n)**2/(n1+n)**2
L= -10*math.log10(1-R)
# Total loss is twice due to reflection
L= L+L
print " Total loss due to Fresnel Reflection in dB =",round(L,2)
#Given
import math
n1= 1.5
n=1.0
y=5.0
a= 25.0
temp1=(1-(y/(2*a)**2))**0.5
temp1=temp1*(y/a)
temp=2*math.acos(0.9996708) # it should be acos(0.1) actually... due to approximations
# answer varies a lot...
temp=math.degrees(temp)-temp1
# temp=temp
tem= 16*(1.5**2)/(2.5**4)
tem=tem/math.pi
temp=temp*tem
Nlat= temp
print " The Coupling efficiency is =",round(Nlat,3)
L= -10*math.log10(Nlat)
print " \n\nThe insertion loss in dB =",round(L,2)
temp1=(1-(y/(2*a)**2))**0.5
temp1=temp1*(y/a)
temp=2*math.acos(0.9996708) # it should be acos(0.1) actually... due to approximations
# answer varies a lot...
temp=math.degrees(temp)-temp1
temp=temp/math.pi
N_new =temp
print " \n\nEfficiency when joint index is matched =",round(N_new,3)
L_new= -10*math.log10(N_new)
print " \n\nThe new insertion loss in dB =",round(L_new,2)